FREE Web Template Download
HTML CSS JAVASCRIPT SQL PHP BOOTSTRAP JQUERY ANGULARJS TUTORIALS REFERENCES EXAMPLES Blog
 

TableData cellIndex Property

TableData Object Reference TableData Object

Example

Click on different cells to alert their index position:

alert("Cell index is: " + x.cellIndex);
Try it Yourself »

Definition and Usage

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


Browser Support

Property
cellIndex Yes Yes Yes Yes Yes

Syntax

Return the cellIndex property:

tabledataObject.cellIndex

Technical Details

Return Value: A Number, representing the position of the cell in the cells collection of the table row

More Examples

Example

Return the index position of each cell in a table row:

var x = document.getElementsByTagName("td");
var txt = "";
var i;
for (i = 0; i < x.length; i++) {
    txt = txt + "The index of Cell " + (i + 1) + " is: " + x[i].cellIndex + "<br>";
}
Try it Yourself »

TableData Object Reference TableData Object