Simple utility for selecting the next / previous 'tabbable' element. Includes and uses the ':tabbable' and ':focusable' selectors from jQuery UI Core.
View the jsFiddle demo.
jQuery.tabbable adds the following methods.
// Focuses the next ':tabable' element.
jQuery.tabNext();
// Focuses the previous ':tabable' element.
jQuery.tabPrev();
// Focuses the previous ':focusable' element.
// Elements which have a tabindex of '-1' are 'focusable', but not 'tabbable'.
jQuery.focusNext();
// Focuses the previous ':focusable' element.
// Elements which have a tabindex of '-1' are 'focusable', but not 'tabbable'.
jQuery.focusPrev();
jQuery.tabbable adds following selectors (which come from jQuery UI Core):
// Select tabbable elements
$(':tabbable');
// Select focusable elements
$(':focusable');
bower install jquery.tabbable --save
or npm install jquery.tabbable --save
jquery.tabbable.min.js