How to create Dynamic table using JQuery I created with .append but problem is when i am clicking on again so create anther table but i want add in to a same table so how can i do that please help me.
$(function () {
$("#addProduct").click(function () {
var table = $('<table></table>').addClass('foo');
for (i = 0; i < 10; i++) {
var row = $('<tr></tr>');
for (i = 0; i < 10; i++) {
var row1 = $('<td></td>').addClass('bar').text('result ' + i);
table.append(row);
row.append(row1);
}
}
$('#someContainer').append(table);
});
});
This is HTML
<button id="addProduct">Add Product</button>
<div id="someContainer"></div>
row1 = $('<td></td>')
that's not a good name