Victor
Victor

Reputation: 951

jquery live tabIndex

I have a jQuery statement that's working fine. How would I re-write it in .live?

 $(document).ready(function()
 {

    $(':input:enabled:visible, a:enabled:visible, span.ValidatorClass').each
    (function(i, e) { $(e).attr('tabindex', i) });


  });

The reason I need this is I hide/show elements sometimes using .show and .hide and when that happens I need to reset tab order for the elements that appear/disappear.

Upvotes: 4

Views: 742

Answers (1)

Kobi
Kobi

Reputation: 138017

Showing and hiding elements raises no events as far as I know, so live won't help you here.

However, since you don't add new elements nor reorder them, you can set the correct tabindex right from the start. The browser will ignore hidden or disabled elements anyway. Run your code without the :visible and enabled filters:

$(':input, a, span.ValidatorClass')
 .each(function(i, e) { $(e).attr('tabindex', i) });

Upvotes: 1

Related Questions