Can I get current row index of a table in Javascript and can we remove the row of table with current Index that we got?
By default the event object will contain the rowindex property
function myFunction() {
var x = document.getElementsByTagName("tr");
var txt = "";
var i;
for (i = 0; i < x.length; i++) {
txt = txt + "The index of Row " + (i + 1) + " is: " + x[i].rowIndex + "
";
}
document.getElementById("demo").innerHTML = txt;
}
Click to show rowIndex
Click to show rowIndex
Click to show rowIndex