Last active
December 14, 2016 08:35
-
-
Save wangwen1220/8310304 to your computer and use it in GitHub Desktop.
JS: jQuery 切换启用和禁用 | toggle disabled input
This file contains hidden or 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
// jQuery 切换启用和禁用表单项 | |
(function ($) { | |
$.fn.toggleDisabled = function() { | |
return this.each(function() { | |
var $this = $(this); | |
if ($this.attr('disabled')) $this.removeAttr('disabled'); | |
else $this.attr('disabled', 'disabled'); | |
}); | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment