Created
June 23, 2010 14:47
-
-
Save cowboy/450017 to your computer and use it in GitHub Desktop.
:focus - get the currently focused element
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
// Public domain, really. | |
jQuery.expr[':'].focus = function( elem ) { | |
return elem === document.activeElement && ( elem.type || elem.href ); | |
}; |
please you send me a sample how to use this selector (:focus) ?
It works like this: :focus selector (note that recent versions of jQuery include this selector)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should this maybe also check for some element that is not an input that has
tabIndex
?