TableRow sectionRowIndex property

Definition and Usage

sectionRowIndex Property returns the position of the row in <tbody>, <thead>, or <tfoot>: rows Collection Location.

See also:

HTML Reference Manual:HTML <tr> Tag

Instance

Example 1

Click on different rows to output their positions:

alert("Section row index is: " + x.sectionRowIndex);

Try It Yourself

Example 2

Returns the position of rows in the thead, tbody, and tfoot collections:

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].sectionRowIndex+"<br>";
}

Try It Yourself

Syntax

Returns the sectionRowIndex property:

tablerowObject.sectionRowIndex

Technical Details

Return Value: Number, representing the position of the row in tbody, thead, or tfoot. rows Collection Location.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support