Skip to content

Instantly share code, notes, and snippets.

@pacoguzman
Created July 27, 2011 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pacoguzman/1109904 to your computer and use it in GitHub Desktop.
Save pacoguzman/1109904 to your computer and use it in GitHub Desktop.
focused() method in Prototype
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