HTML DOM Element tabIndex
Examples
Change the tab order for 3 links:
document.getElementById("myAnchor1").tabIndex = "3";
document.getElementById("myAnchor2").tabIndex = "2";
document.getElementById("myAnchor3").tabIndex = "1";
Try it Yourself »
Get the tab order of the first <a> element:
let order = document.getElementsByTagName("A")[0].tabIndex;
Try it Yourself »
Definition and Usage
The tabIndex
property sets or returns the value of the tabindex attribute of an element.
The tabindex attribute specifies the tab order of an element, when the "tab" button is used for navigating.
See Also:
Syntax
Return the tabIndex property:
element.tabIndex
Set the tabIndex property:
element.tabIndex = number
Return Value
Type | Description |
number | Tab order of the element (1 is first). If the number is negative, the element is removed from the tab order. |
Return Value
Type | Description |
Number | The tab order of the element. |
Browser Support
element.tabIndex
is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |