Created
July 27, 2011 17:22
-
-
Save pacoguzman/1109904 to your computer and use it in GitHub Desktop.
focused() method in Prototype
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
Element.addMethods({ | |
focused: function(element) { | |
return element === document.activeElement && ( element.type || element.href ); | |
} | |
}); | |
$(document).on('mouseleave', 'input.special', function(e, el){ | |
if (!el.focused() || el.focused().length == 0) { | |
el.removeClassName("special-focus"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment