Skip to content
Related Articles

Related Articles

HTML | DOM TableHeader cellIndex Property
  • Last Updated : 31 Oct, 2019

the TableHeader cellIndex Property in HTML DOM is used for returning the position of a cell in the cells collection of a table row.


  • It return the cellIndex Property:

    Return Value: It returns a numeric value which represents the position of the cell in the cells collection of a table row.


    <!DOCTYPE html>
        <!-- style to set border -->
            td {
                border: 1px solid black;
        <h2>DOM TableHeader CellIndex Property</h2>
                <th id="gfg" onclick="myGeeks(this)">
                <th id="gfg" onclick="myGeeks(this)">
            Click on TableHeader to get the CellIndex th element.
        <!-- Script to access th element -->
            function myGeeks(x) {
                alert("cell index is: " + x.cellIndex);

    Before Clicking On Table cell:

    After Clicking On Table cell:

    Supported Browsers: The browsers supported by DOM TableHeader cellIndex Property are listed below:

    • Google Chrome
    • Internet Explorer
    • Firefox
    • Apple Safari
    • Opera

    My Personal Notes arrow_drop_up
  • Recommended Articles
    Page :