Example 1 — Read ariaRowIndex
Log the row index from a column header cell.
const el = document.getElementById("role-heading");
console.log(el.ariaRowIndex); // "1"
// HTML: <th id="role-heading" … aria-rowindex="1"> How It Works
- Find the cell.
getElementByIdreturns the header node. - Read the reflection.
ariaRowIndexreturns thearia-rowindexstring. - Interpret
"1". This cell sits in the first row of the full table. - Missing attribute. If unset, many browsers return
null.

