Posted By

tbelknap on 04/14/10


Tagged

forms tabindex


Versions (?)

Organize Tab Indeses using jQuery


 / Published in: jQuery
 

Keeping track of complex forms - especially those that exist within multiple jQuery UI tabs - can be a pain. This is a simple little function that will reorganize all visible inputs, buttons, drop-downs and links. Use it whenever switching between tabs or adding new elements to the form.

  1. /*////////////////////////////////////////////////////////////////
  2. // oesTabIndexes: Reorganizes tab indexes on the page. //
  3. ////////////////////////////////////////////////////////////////*/
  4. jQuery.fn.oesTabIndexes = function() {
  5. var tabindex = 1;
  6. $("input:visible, select:visible, button:visible, a:visible").each(function() {
  7. $(this).attr("tabindex", tabindex);
  8. tabindex++;
  9. });
  10. }

Report this snippet  

You need to login to post a comment.