How can I delete all rows of an HTML table except the If you can declare an \'s using Javascript, and without looping through all the rows in the table? I have a very huge
ID
for tbody
you can simply run this function:var node = document.getElementById("tablebody");
while (node.hasChildNodes()) {
node.removeChild(node.lastChild);
}