Jquery live tabIndex

I have a jQuery instruction that works fine. How to rewrite 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 to hide / show elements, sometimes using .show and .hide , and when that happens, I need to reset the tab order for the elements that appear / disappear.

+4
source share
1 answer

Showing and hiding elements does not create any events as far as I know, so live will not help you.

However, since you are not adding new elements or changing their order, you can set the correct tabindex from the very beginning. In any case, the browser will ignore hidden or disabled items. Run your code without filters :visible and enabled :

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

Source: https://habr.com/ru/post/1304652/


All Articles