Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript/JQuery remove from tabindex

Tags:

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?

like image 470
leepowers Avatar asked Jan 01 '10 05:01

leepowers


People also ask

How do I remove a Tabindex attribute?

removeAttribute('tabindex'); You can set tabindex by this. Show activity on this post. Use Jquery removeAttr to remove the attribute from any element.

How do I skip Tabindex?

The way to do this is by adding tabindex="-1" . By adding this to a specific element, it becomes unreachable by the keyboard navigation.

What does Tabindex =- 1 mean?

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.

How do I stop Tabindex in HTML?

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.


1 Answers

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); 
like image 200
Jage Avatar answered Oct 16 '22 05:10

Jage