3a33dfb006602a2f2565bf3a5c3e60ce8205bd19
[lhc/web/wiklou.git] / resources / jquery / jquery.tabIndex.js
1 /**
2 * Finds the lowerst tabindex in use within a selection
3 *
4 * @return Integer of lowest tabindex on the page
5 */
6 jQuery.fn.firstTabIndex = function() {
7 var minTabIndex = 0;
8 jQuery(this).find( '[tabindex]' ).each( function() {
9 var tabIndex = parseInt( jQuery(this).attr( 'tabindex' ) );
10 if ( tabIndex > minTabIndex ) {
11 minTabIndex = tabIndex;
12 }
13 } );
14 return minTabIndex;
15 };
16 /**
17 * Finds the highest tabindex in use within a selection
18 *
19 * @return Integer of highest tabindex on the page
20 */
21 jQuery.fn.lastTabIndex = function() {
22 var maxTabIndex = 0;
23 jQuery(this).find( '[tabindex]' ).each( function() {
24 var tabIndex = parseInt( jQuery(this).attr( 'tabindex' ) );
25 if ( tabIndex > maxTabIndex ) {
26 maxTabIndex = tabIndex;
27 }
28 } );
29 return maxTabIndex;
30 };