【发布时间】:2021-05-11 03:04:03
【问题描述】:
我想将一个嵌套数组转换为一个 HTML 表格,我在其中分配了table_header。
同样,Column_1 中的第一个子数组和Column_2 中的第二个子数组。
const arr = [
[
"abc",
"gsdg",
"fsvth",
"rewurths",
"ejgfjsgfns",
"sdbqeqtjhbq"
],
[
"ryethabe"
]
]
<table id="table">
<thead>
<tr>
<th>Column_1</th>
<th>Column_2</th>
</tr>
</thead>
<tbody id="table_data_response">
</tbody>
</table>
【问题讨论】:
-
也许 Stack Overflow 上另一篇帖子的以下答案满足您的需求:stackoverflow.com/a/51276151/3272066(具体来说,答案中的函数
append_json)。 -
我修复了你的表格 html。它无效 - 预期的输出是什么?画一张图并展示你尝试过的 JavaScript
标签: javascript html html-table