Search w3schools.com:

SHARE THIS PAGE

tr sectionRowIndex Property

tr Object Reference tr Object

Definition and Usage

The sectionRowIndex property returns the position of a row in the rows collection of a tbody, thead, or tfoot.

Syntax

Return the sectionRowIndex property:

trObject.sectionRowIndex

Tip: There is no default value for the sectionRowIndex property.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The sectionRowIndex property is supported in all major browsers.


Example

Example

Alert the position of the rows in the thead, tbody, and tfoot rows collection:

<html>
<head>
<script>
function displayResult(x)
{
alert("Section row index is: " + x.sectionRowIndex);
}
</script>
</head>
<body>

<table border="1">
  <thead>
  <tr onclick="displayResult(this)">
    <th>Click to show sectionRowIndex</th>
  </tr>
  <tr onclick="displayResult(this)">
    <th>Click to show sectionRowIndex</th>
  </tr>
  </thead>
  <tbody>
  <tr onclick="displayResult(this)">
    <td>Click to show sectionRowIndex</td>
  </tr>
  <tr onclick="displayResult(this)">
    <td>Click to show sectionRowIndex</td>
  </tr>
  </tbody>
  <tfoot>
  <tr onclick="displayResult(this)">
    <td>Click to show sectionRowIndex</td>
  </tr>
  <tr onclick="displayResult(this)">
    <td>Click to show sectionRowIndex</td>
  </tr>
  </tfoot>
</table>

</body>
</html>

Try it yourself »


tr Object Reference tr Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]