HTML DOM Element tabIndex Property
- Previous Page style
- Next Page tagName
- Go to the Previous Level HTML DOM Elements Object
Definition and Usage
tabIndex
The attribute sets or returns the value of the element's tabindex property.
When the "Tab" button is used for navigation,tabindex
The attribute specifies the tab key control order of the element.
See also:
Example
Example 1
Change the tab order of 3 links:
document.getElementById("myAnchor1").tabIndex = "3"; document.getElementById("myAnchor2").tabIndex = "2"; document.getElementById("myAnchor3").tabIndex = "1";
Example 2
Get the tab order of the first <a> element:
let order = document.getElementsByTagName("A")[0].tabIndex;
Syntax
Return tabIndex property:
element.tabIndex
Set the tabIndex property:
element.tabIndex = number
Return value
Type | Description |
---|---|
Number |
The Tab key control order of the element (1 is the first). If the number is negative, remove the element from the Tab key sequence. |
Browser Support
All Browsers Support element.tabIndex
:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support | Support |
- Previous Page style
- Next Page tagName
- Go to the Previous Level HTML DOM Elements Object