tr rowIndex Property
tr Object
Definition and Usage
The rowIndex property returns the position of a row in the rows collection of a table.
Syntax
Return the rowIndex property:
Tip: There is no default value for the rowIndex property.
Browser Support

The rowIndex property is supported in all major browsers.
Example
Example
Alert the position of the rows in the table's rows collection:
<html>
<head>
<script>
function displayResult(x)
{
alert("Row index is: " + x.rowIndex);
}
</script>
</head>
<body>
<table border="1">
<tr onclick="displayResult(this)">
<td>Click to show rowIndex</td>
</tr>
<tr onclick="displayResult(this)">
<td>Click to show rowIndex</td>
</tr>
<tr onclick="displayResult(this)">
<td>Click to show rowIndex</td>
</tr>
</table>
</body>
</html>
Try it yourself »
tr Object
Thank You For Helping Us!
Your message has been sent to W3Schools.
Close [X]