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 »
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.
Return the tabIndex property:
element.tabIndex
Set the tabIndex property:
element.tabIndex =
number
Type | Description |
number | Tab order of the element (1 is first). If the number is negative, the element is removed from the tab order. |
Type | Description |
Number | The tab order of the element. |
element.tabIndex
is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!