Skip to content

Instantly share code, notes, and snippets.

@paulirish
Created January 7, 2010 18:15
Show Gist options
  • 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