jQuery.fn.extend({
disable: function (state) {
return this.each(function () {
var $this = jQuery(this);
if ($this.is('input, button'))
this.disabled = state;
else if($this.is('a'))
$this.toggleClass('disabled', state);
});
}
});