﻿jQuery.extend(jQuery.expr[":"], {
        enabled : function(a){ return !jQuery.attr(a, 'disabled'); },
        disabled : function(a){ return jQuery.attr(a, "disabled"); }
});


jQuery.fn.extend({
    disable : function() {
        return this.each(function(){ jQuery(this).attr("disabled", true); });
    },
    enable : function() {
        return this.each(function(){ jQuery(this).removeAttr("disabled"); });
    },
    toggleDisabled : function() {
        return this.each(function(){
            $(this)[$(this).is(":enabled") ? "disable" : "enable"]();
        });
    }
});