Created
December 21, 2018 14:43
-
-
Save koirikivi/a7c4f33495375007479714497dedf8dc to your computer and use it in GitHub Desktop.
Getting next available tabindex with jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getNextAvailableTabIndex() { | |
var tabIndexes = $('[tabIndex]').map(function() { | |
return parseInt($(this).attr('tabindex'), 10); | |
}).toArray(); | |
tabIndexes.push(0); // account for [] and [-1] | |
return Math.max.apply(null, tabIndexes) + 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment