Difference between revisions of "Jquery table things"
From John Freier
(Created page with '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. …') |
|||
(One intermediate revision by the same user not shown) | |||
Line 11: | Line 11: | ||
$('tbody tr:eq(1)', this).remove(); | $('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(""); | ||
}); | }); |
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(""); });