I have the following code which creates a new table.
var html = '<table>';
$.each( results.d, function( index, record ) {
html += '<tr><td>' + record.ClientCode + '</td></tr>';
});
html += '</table>';
$("#divResults").append(html);
How do I change this so instead of creating a brand new table each time, it adds tr and td data to an already existing table? Where the new data always gets added after the last existing tr/td in the table?
If you already have created html table in #divResults div, you can try:
$.each( results.d, function( index, record ) {
$('#divResults table tr:last').after('<tr><td>' + record.ClientCode + '</td></tr>');
});
Example
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