60
rated 0 times
[
61]
[
1]
/ answers: 1 / hits: 25573
/ 12 Years ago, mon, may 21, 2012, 12:00:00
I've got a simple question, I want to delete the last row in a table, I copied one function that deletes the checked one though:
function deleterow(tableID) {
try {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
for(var i=1; i<rowCount; i++) {
var row = table.rows[i];
var chkbox = row.cells[0].childNodes[0];
if(null != chkbox && true == chkbox.checked) {
table.deleteRow(row);
rowCount--;
i--;
}
}
}catch(e) {
alert(e);
}
}
How do I change it, so that it will delete only the last row each time it's called? Thank you all for the help! I really appreciate it!
More From » javascript