Easy Tutorial
❮ Jsref Asin Jsref Regexp Wordchar ❯

td/thcellIndex Property


Definition and Usage

The cellIndex property returns the position of a cell in the collection of cells within a row.

Syntax

Return the cellIndex property:

Note: The cellIndex property has no default value.


Browser Support

All major browsers support the cellIndex property.


Example

Display the position (cellIndex) of a cell:

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>tutorialpro.org(tutorialpro.org)</title> 
<script>
function displayResult(x){
    alert("Cell index is: " + x.cellIndex);
}
</script>
</head>
<body>

<table border="1">
    <tr>
        <td onclick="displayResult(this)">Click to show cell index</td>
        <td onclick="displayResult(this)">Click to show cell index</td>
    </tr>
</table>

</body>
</html>

❮ Jsref Asin Jsref Regexp Wordchar ❯