Mayur
Mayur

Reputation: 3015

Tabindex is not working in ie 7

I used a tabindex in my code, everything is going great its works finr in Firefox, ie8, safari but its not working properly in ie7, when i used a tab index in ie7 it come up to two input file then it get back to index one;

example:

<div tabindex=1>
    <a onclick="slide_down()" style="cursor:pointer;width:160px; padding-bottom:10px;" >sample link</a>
</div>
<div tabindex=2>
    <a onclick="slide_down()" style="cursor:pointer;width:160px; padding-bottom:10px;" >sample link1</a>
</div>
<div tabindex=3>
    <a onclick="slide_down()" style="cursor:pointer;width:160px; padding-bottom:10px;" >sample link2</a>
</div>

Thanks

Upvotes: 1

Views: 3996

Answers (4)

Ghaleb Khaled
Ghaleb Khaled

Reputation: 180

Make sure that you use "tabIndex" with "I" capital letter not "tabindex"

Upvotes: 1

brothercake
brothercake

Reputation: 51

As of IE5 any element can have a tabindex. All current browsers now implement this behavior, and your original example will work fine in Opera, Firefox and Webkit.

But I don't know why your example doesn't work in IE7, because it should. Changing to a link is a pragmatic solution and will fix it, but shouldn't be necessary.

You might try programatically re-applying it using the camel-cased property name (which is required by older IE versions for most set-attribute values):

myDiv.setAttribute('tabIndex', '0');

Upvotes: 2

Treur
Treur

Reputation: 763

Tabindex isn't allowed on a div tag. Try to put it in your link:

<div>
    <a tabindex="1" onclick="slide_down()" style="cursor:pointer;width:160px; padding-bottom:10px;" >sample link</a>
</div>

Upvotes: 1

lornova
lornova

Reputation: 6953

Are you using a DOCTYPE? Since tabindex is not supported in DIV tag, and IE7 compatibility layer may enable or disable the attribute based on DOCTYPE.

From HTML 4 specification:

The following elements support the tabindex attribute: A, AREA, BUTTON, INPUT, OBJECT, SELECT, and TEXTAREA.

http://www.w3.org/TR/REC-html40/

Upvotes: 0

Related Questions