Delete all rows in an HTML table

K'' picture K'' · Sep 1, 2011 · Viewed 265k times · Source

How can I delete all rows of an HTML table except the <th>'s using Javascript, and without looping through all the rows in the table? I have a very huge table and I don't want to freeze the UI while I'm looping through the rows to delete them

Answer

Apparao picture Apparao · Sep 13, 2013

this will remove all the rows:

$("#table_of_items tr").remove();