Skip to content

Instantly share code, notes, and snippets.

@paulirish
Created January 7, 2010 18:15
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 paulirish/271424 to your computer and use it in GitHub Desktop.
Save paulirish/271424 to your computer and use it in GitHub Desktop.
//
// Replicates .activate() from the Prototype JS library.
// http://www.prototypejs.org/api/form/element/activate
//
jQuery.fn.activate = function() {
if ('focus' in this) this.focus();
if ('select' in this && (this.tagName != 'INPUT' || !(/^(?:button|reset|submit)$/i.test(this.type)))) {
this.select();
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment