$.fn.disable = function() { this.each(function() { this.setAttribute('disabled', 'disabled'); }); }; $.fn.enable = function() { this.each(function() { this.removeAttribute('disabled'); }); };