How can I add multiple rows to a table dynamically using jQuery or JavaScript.
You can use append() to add single row one after the other :
<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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With