jquery dynamically update table rows data
Filed Under (jquery) by admin on 01-12-2008
Tagged Under : jquery
To dynamically change the table rows use this smart approach using jquery
Assign your new table data rows to a variable
var msg="<tr><td>Kristine</td><td>18</td><td>peach</td></tr><tr><td>Vanessa</td><td>25</td><td>strawberry</td></tr>";
Delete the exsiting rows except for the header tr:first – represents first row of the table – which happens to be our header
$("table tr:first").siblings().remove();
Then add the new data, the msg javascript variable used here holds the new table rows data
$("table tr:first").after(msg);
I have a very detailed step by step tutorial you can view here


