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 );
15 minTabIndex
= tabIndex
;
16 // In IE6/IE7 the above jQuery selector returns all elements,
17 // becuase it has a default value for tabIndex in IE6/IE7 of 0
18 // (rather than null/undefined). Therefore check "> 0" as well
19 } else if ( tabIndex
> 0 && tabIndex
< minTabIndex
) {
20 minTabIndex
= tabIndex
;
27 * Finds the highest tabindex in use within a selection
29 * @return number Highest tabindex on the page
31 $.fn
.lastTabIndex = function() {
32 var maxTabIndex
= null;
33 $(this).find( '[tabindex]' ).each( function( i
) {
34 var tabIndex
= parseInt( $(this).attr( 'tabindex' ), 10 );
36 maxTabIndex
= tabIndex
;
37 } else if ( tabIndex
> maxTabIndex
) {
38 maxTabIndex
= tabIndex
;