Delete rows of a table

Rajni.Shekhar
Posted by Rajni.Shekhar under JavaScript category on | Points: 40 | Views : 1182
//to delete all rows of a table
function DeleteAllRows(tblName){
var table = document.getElementById(tblName);
var rowCount = table.rows.length;

for (var i = 1; i < rowCount; i++)
{
var row = table.rows[i];
{
table.deleteRow(i);
rowCount--;
i--;
}
}
}

Comments or Responses

Login to post response