jquery – 在IE6,IE7,IE8中禁用按钮?

我试图禁用一个按钮 – 在IE中使用jQuery 1.4.4以下代码

jQuery(‘#id’).attr(“disabled”,true);

随着HTML

<button id="id" type="button"
    class="some-class"
     disabled="">Comment</button>

适用于FF,Chrome等,当然,在IE中不起作用?我该怎么办?

即< button disabled =“disabled”>似乎不适用于IE或?

修改:另请注意< button id ='id'已停用> foobar< / button>是有效的HTML

解决方法

XML / HTML属性值是字符串.值“true”和“false” have no special meaning (technically,they aren’t even allowed).约定是将值设置为属性名称
jQuery('#id').attr("disabled","disabled");

另请注意,在HTML中,< button disabled =“”>将已禁用该按钮.只需省略disabled属性或使用jQuery重新启用它:

jQuery('#id').removeAttr("disabled");

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...