td/th cellIndex Property
td/th Object
Definition and Usage
The cellIndex property returns the position of a cell in the cells collection
of a table row.
Syntax
Return the cellIndex property:
tdObject.cellIndex
or
thObject.cellIndex
Tip: There is no default value for the cellIndex property.
Browser Support

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