开发者

skip focus from TAB jump

I have a paragraph with various html elements. Some links, some input boxes, etc. The TAB button changes focus from the current element to the next html element: it jumps from link to link. Is it possible to set a spec开发者_StackOverflowific html element to be "skipped" from such focus from the TAB button?


The tabindex attribute controls tabbing. Set it to -1 and the tab key will not stop on that element.

<input tabindex="-1" />

Set it to a non-negative number and you can control the tab order. From the W3C spec:

The following elements support the tabindex attribute: A, AREA, BUTTON, INPUT, OBJECT, SELECT, and TEXTAREA.

In HTML5 you can use the tabindex attribute on any element. From 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 and title.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜