Organize Tab Indeses using jQuery

/ Published in: jQuery
Save to your folder(s)

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.

Copy this code and paste it in your HTML
  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


RSS Icon Subscribe to comments

You need to login to post a comment.