0

Lets take a scenario, where in I have a series of buttons btn1, btn2, btn3...

I kept pressing 'tab' key and my focus is on btn2. Now I want to avoid btn3 or any other beyond btn2 not to get focus on tab key press.

How can I achieve this?

4

1 回答 1

4

可以使用 tabindex 属性更改 tab 键的行为。这是元素将具有焦点的顺序。

    <button id="1" tabindex="-1">Some content</button> 

你应该防止焦点在你的按钮上。

或像这样:

 $(".btnclass").attr("tabindex", "-1");

检查这个:http ://www.htmlcodetutorial.com/forms/_INPUT_TABINDEX.html

于 2013-03-11T08:10:36.653 回答