6 * Finds the lowerst tabindex in use within a selection
8 * @return number Lowest tabindex on the page
10 $.fn
.firstTabIndex = function() {
11 var minTabIndex
= null;
12 $(this).find( '[tabindex]' ).each( function( i
) {
13 var tabIndex
= parseInt( $(this).attr( 'tabindex' ), 10 );
14 // In IE6/IE7 the above jQuery selector returns all elements,
15 // becuase it has a default value for tabIndex in IE6/IE7 of 0
16 // (rather than null/undefined). Therefore check "> 0" as well
19 minTabIndex
= tabIndex
;
20 } else if ( tabIndex
< minTabIndex
) {
21 minTabIndex
= tabIndex
;
29 * Finds the highest tabindex in use within a selection
31 * @return number Highest tabindex on the page
33 $.fn
.lastTabIndex = function() {
34 var maxTabIndex
= null;
35 $(this).find( '[tabindex]' ).each( function( i
) {
36 var tabIndex
= parseInt( $(this).attr( 'tabindex' ), 10 );
38 maxTabIndex
= tabIndex
;
39 } else if ( tabIndex
> maxTabIndex
) {
40 maxTabIndex
= tabIndex
;