且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

removeAttr() 不删除“已禁用";IE中的属性

更新时间:2023-12-05 12:07:28

使用 .prop 而不是 .attr 来影响元素的禁用状态:

Use .prop instead of .attr to affect an element's disabled state:

var disableSelection = function(){
    $("#elementId").prop("disabled", true);    
};

var enableSelection = function(){
    $("#elementId").prop("disabled", false);
};

有关详细信息,请参阅.prop() 与 .attr().

For more information, see .prop() vs .attr().