我有一个包含各种 html 元素的段落。一些链接,一些输入框等。 TAB 按钮将焦点从当前元素转移到下一个 html 元素:它从一个链接跳转到另一个链接。是否可以将特定的 html 元素设置为从 TAB 按钮的此类焦点中“跳过”?
最佳答案
tabindex
属性控制制表符。将其设置为 -1
,tab 键将不会停在该元素上。
<input tabindex="-1" />
设置为非负数,可以控制跳位顺序。来自W3C spec :
The following elements support the tabindex attribute:
A
,AREA
,BUTTON
,INPUT
,OBJECT
,SELECT
, andTEXTAREA
.
在 HTML5 您可以在任何 元素上使用tabindex
属性。来自 HTML5 differences from HTML4 :
Several attributes from HTML4 now apply to all elements. These are called global attributes:
accesskey
,class
,dir
,id
,lang
,style
,tabindex
andtitle
.
关于jquery - 从 TAB 跳转中跳过焦点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6823876/