Created
July 7, 2020 16:26
-
-
Save mrtag23/4d585f54c98b0cb9353f2e6bd599bd10 to your computer and use it in GitHub Desktop.
get all focusable elements
This file contains 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
var focusable = document.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'); | |
var firstFocusable = focusable[0]; | |
var lastFocusable = focusable[focusable.length - 1]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment