Last active
September 25, 2015 10:18
-
-
Save Mottie/905993 to your computer and use it in GitHub Desktop.
Enable or disable objects using jQuery
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
/* 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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because I'm a lazy typer :P