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 / 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?
removeAttribute('tabindex'); You can set tabindex by this. Show activity on this post. Use Jquery removeAttr to remove the attribute from any element.
The way to do this is by adding tabindex="-1" . By adding this to a specific element, it becomes unreachable by the keyboard navigation.
A negative value (usually tabindex="-1" ) means that the element is not reachable via sequential keyboard navigation, but could be focused with JavaScript or visually by clicking with the mouse. It's mostly useful to create accessible widgets with JavaScript.
To prevent tab indexing on specific elements, you can use tabindex="-1". If the value is negative, the user agent will set the tabindex focus flag of the element, but the element should not be reachable with sequential focus navigation. Note that this is an HTML5 feature and may not work with old browsers.
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With