Cherry, Tabindex behaves differently across browsers. For example, IE expects the tabindex attribute to be in camel case ("tabIndex"). It also returns differently-typed values than FireFox, and can be more difficult to query for the presence of a tabindex attribute.
I've written a little tabindex plugin for jQuery that normalizes this behaviour. I've built it as part of a larger plugin to make adding keyboard navigation really easy. The tabindex plugin is available here: https://source.fluidproject.org/svn/sandbox/tabindex/trunk/jquery.tabindex.js Documentation is available here: http://wiki.fluidproject.org/display/fluid/Fluid+jQuery+Plugins So a modified version of Dennis' snippet using the tabindex plugin should work: $('a').each(function(index, element){ $(element).tabindex(index); }); Let me know how it goes, Colin On 17-Feb-08, at 12:06 AM, [EMAIL PROTECTED] wrote: > > Totally fair point, and one that Dennis's snippet doesn't fix > entirely. > > I was fretting over http://jquery.cherryaustin.com, which has a nested > div structure. The 'natural' tabs were all over the place - the divs > are all javascript show/hide jobs, and various browsers set various > tabs according to what they deemed visible (or so it seems, anyhow!). > I started off manually setting tabs to fit in with the nested > structure. Got fed up. Requested help. > > This little code does exactly as it says in Firefox. IE7 seems to > disregard it, setting its own tabs according to its own rules ... > haven't tried it elsewhere. > > As my site is basically an off-the-cuff blog, I'm just happy to have > my tabs set in *some* sort of logical order. But, if we're looking for > lessons out of the exercise, I'd say: [1] Natural (browser) tabbing > isn't reliable, if your page has a complex/mutable structure; [2] > Auto- > magic indexing isn't reliable either, but is better than an abandoned > manual system! > > On Feb 16, 11:48 pm, "Karl Rudd" <[EMAIL PROTECTED]> wrote: >> I'm curious as to why this would need to be done. By "default" links >> on a page have a tabindex based on their position in the HTML so >> there's usually no need to set the tabindex. >> >> Interesting article on the >> subject:http://www.webaim.org/techniques/keyboard/tabindex.php >> >> Karl Rudd >> >> On Feb 17, 2008 3:21 AM, [EMAIL PROTECTED] >> >> <[EMAIL PROTECTED]> wrote: >> >>> or does anyone know how to make one? Something that will >>> incrementally >>> number the tabindexes for all the hrefs on a page? It's a shot in >>> the >>> dark, but worth trying to save all that effort! >>> Cherry :) >> >>> http://jquery.cherryaustin.com --- Colin Clark Technical Lead, Fluid Project http://fluidproject.org