Javascript/JQuery remove from tabindex
On an HTML form I have INPUT text box followed by a link, then followed by another INPUT text box. I want to remove the link from the tabindex /开发者_StackOverflow中文版 tab order:
<p>
<input type="text" name="field1" id="field1" value="" />
<a href="..a url.." id="link1">more info</a>
</p>
<p>
<input type="text" name="field2" id="field2" value="" />
</p>
The tab order is field1, link1, field2 and I want it to be field1, field2 without link1 in the tabindex / order at all. Aside from reordering via the tabindex
attribute, is there any way to remove link1 from tabbing altogether?
You can achieve this with html:
<p>
<input type="text" name="field1" id="field1" value="" />
<a href="#" id="link1" tabindex="-1">more info</a>
</p>
<p>
<input type="text" name="field2" id="field2" value="" />
</p>
You could also use jquery to do this:
$('#link1').prop('tabIndex', -1);
精彩评论