Using jQuery, how do I delete all rows in a table except the first? This is my first attempt at using index selectors. If I understand the examples correctly, the following sh
I think this is more readable given the intent:
$('someTableSelector').children( 'tr:not(:first)' ).remove();
Using children also takes care of the case where the first row contains a table by limiting the depth of the search.
If you had an TBODY element, you can do this:
$("someTableSelector > tbody:last").children().remove();
If you have THEAD or TFOOT elements you'll need to do something different.