-
-
Save addyosmani/721240 to your computer and use it in GitHub Desktop.
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
(function($) { | |
$.fn.enable = function() { | |
// Enable each selected element by removing its 'disabled' attribute. | |
return this.each(function() { | |
$(this).removeAttr('disabled'); | |
}); | |
}; | |
$.fn.disable = function() { | |
return this.each(function() { | |
// Disable each selected element that is a form control by setting | |
// its 'disabled' attribute. | |
if ($(this).is(':input')) { | |
$(this).attr('disabled', 'disabled'); | |
} | |
}); | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment