开发者

How to change input field switch sequence (swithcing input field using Tab key) on a web page?

On a web page, if there are input fields, pressing Tab key switches them, but in a particular order, is there a way to change this order and set it to some different order?

开发者_如何学Go

If this can be done in html, it is preferable, but if some other scripting language (javascript etc) can do it, it is also acceptable.


The attribute tabindex takes care of that http://www.w3.org/TR/WCAG-TECHS/H4.html to exclude a element completely from the tabindex give it a index of -1 the lowest safe index to start with is 1.

0 is the default value so should be avoided when explicitly setting the tabindex

<input tabindex=1 type="text" name="my_input1">
<input tabindex=3 type="text" name="my_input2">
<input tabindex=2 type="text" name="my_input3">

The tab would go from the my_input1 to my_input3 to my_input2 field in this example

tabindex may be used on a, area, button, input, object, select and textarea

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜