Skip to content

Instantly share code, notes, and snippets.

@Mottie
Last active September 25, 2015 10:18
Show Gist options
  • Save Mottie/905993 to your computer and use it in GitHub Desktop.
Save Mottie/905993 to your computer and use it in GitHub Desktop.
Enable or disable objects using jQuery
/* Enable or disable DOM objects
* This is a basic script - it won't determine
* if an object can be enabled or disabled
*
* Use: $('button').disable();
* $('button').enable();
*/
(function($){
$.fn.extend( {
enable : function(){
return this.removeAttr('disabled');
},
disable: function(){
return this.attr('disabled', 'disabled');
}
});
})(jQuery);
@Mottie
Copy link
Author

Mottie commented Apr 6, 2011

Because I'm a lazy typer :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment