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
Another way to accomplish this is using the empty() function of jQuery with the thead and tbody elements in your table.
Example of a table:
Col1 Col2
some content
to be removed
And the jQuery command:
$("#tableId > tbody").empty();
This will remove every rows contained in the tbody element of your table and keep the thead element where your header should be. It can be useful when you want to refresh only the content of a table.