Difference between revisions of "Jquery table things"
From John Freier
Line 15: | Line 15: | ||
Clear the last column on all rows in a table | Clear the last column on all rows in a table | ||
− | $('#form-batch tr').each(function(){ | + | $('#form-batch tr').each(function(){ |
$(this).find('td:last').html(""); | $(this).find('td:last').html(""); | ||
− | }); | + | }); |
Latest revision as of 13:31, 22 September 2011
These are a bunch of different table manipulation things.
Add a new row to a table
$('#tableId tr:last').after('<tr><td>item</td></tr>');
Remove all the rows of a table.
$('#form-batch').each(function(){ while($('tr', this).length>1){ $('tbody tr:eq(1)', this).remove(); } });
Clear the last column on all rows in a table
$('#form-batch tr').each(function(){ $(this).find('td:last').html(""); });