TableRow rowIndex Property

❮ TableRow Object

Example

Click on different rows to alert their index position:

alert("Row index is: " + x.rowIndex);
Try it Yourself »

Description

The rowIndex property returns the position of a row in the rows collection of a table.


Browser Support

Property
rowIndex Yes Yes Yes Yes Yes

Syntax

Return the rowIndex property:

tablerowObject.rowIndex

Technical Details

Return Value: A Number, representing the position of the row in the rows collection of a table

More Examples

Example

Return the index position of each row in a table:

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+"<br>";
}
Try it Yourself »

❮ TableRow Object
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.