It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center 。
8年前关闭。
如何使用 jQuery 或 JavaScript 将多行动态添加到表中。
8年前关闭。
如何使用 jQuery 或 JavaScript 将多行动态添加到表中。
最佳答案
您可以使用 append() 逐行添加单行:
<table id="add"></table>
<script type="text/javascript">
function addRow()
{
var str ="";
for(var i=0;i<20;i++)
{
str+="<tr>";
str+="<td>"+i+"</td>";
str+="</tr>";
}
$('#add').html(str); or $('#add').append(str);
}
</script>
关于javascript - 使用 JavaScript 或 jQuery 向表中添加多行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14314325/