我试图在HTML中创建一个表格,并希望用jQuery来提高它。我怎样才能用JQuery填充表格html
该表是静态的,我希望首先调用“Index”的第一列生成一个带for循环的索引列表。对于视觉像这样:
Indice | champs 1 | champs 2 | champs 3 |
1
2
3
4
...
我的表中有标识id ="balance"
,我想后,生成表的字段的其余部分。
代码我想:
for (i = 1; i <= 8; i++) {
$('.bilan td:first-child').append("<td><strong>" + i + "</strong></td>");
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<table class="bilan" cellspacing="0">
<tr>
<td><strong>Indice</strong></td>
<td><strong>Comptoir</strong></td>
<td><strong>Nb commandes</strong></td>
<td><strong>CA (€)</strong></td>
<td><strong>% CA</strong></td>
<td><strong>Nouveaux clients</strong></td>
</tr>
</table>
欢迎SO,你能分享一些代码,你已经尝试了,我们能看到你可能会去错了吗? – Pogrindis
这可能是相关的:http://stackoverflow.com/questions/8749236/create-table-with-jquery-append – Pogrindis
请访问[帮助]和[游览]看看什么和如何问 – mplungjan