Change the tab order for three links:
More "Try it Yourself" examples below.
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).
Property | |||||
---|---|---|---|---|---|
tabIndex | Yes | Yes | Yes | Yes | Yes |
Return the tabIndex property:
Set the tabIndex property:
Value | Description |
---|---|
number | Specifies the tabbing order of the element (1 is first). Note: If the number negative, the element will be removed from the tab order |
Return Value: | A Number, representing the tab order of the element |
---|
Get the tab order of the first <a> element (index 0) in the document:
The result of x will be:
HTML reference: HTML tabindex Attribute