使用jQuery的prop()切换禁用属性不起作用

首先是 the fiddle
$('#enableButtonB').click(function (e) {
   if($(e.target).is(':checked'))
   {
       $('#myButtonB').removeProp('disabled');
       alert('Enable Button B');
   }
   else
   {
       $('#myButtonB').prop('disabled',true); 
       alert('disable Button B');
   }
});

我试图使用jQuery的.prop()和removeProp()方法来启用和禁用基于某些条件的按钮。在元素上调用removeProp()后,它似乎工作正常。之后任何后续的对prop()的调用无法禁用按钮。

什么是反复启用和禁用元素的正确方法

解决方法

代替
.removeProp('disabled')

使用

.prop('disabled',false)

小提琴:http://jsfiddle.net/kqnZz/6/

相关文章

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