开发者

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.


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) });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜