views:

280

answers:

1

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?

+1  A: 

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').each(function(){
    this.tabIndex = -1;
});
Jage
It works and it resolves a problem I have, but will it validate/is it crossbrowser compatible.? W3 says tabindex should be between 0 and 32767..?
pnichols
It validates using transitional doctype (I didn't check any others) and worked in FF, safari, chrome, opera, and IE 6,7,8.
Jage