Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery.prop(“disabled”,false)不在Chrome中工作_Jquery_Prop - Fatal编程技术网

jQuery.prop(“disabled”,false)不在Chrome中工作

jQuery.prop(“disabled”,false)不在Chrome中工作,jquery,prop,Jquery,Prop,由于.prop(“disabled”,false)有问题,它在opera和firefox中运行良好,但IE和chrome我无法让它运行 事实上,这是一个邀请表,我会像这样做发送按钮 <input id="sendInvite" class="mail_send" disabled="disabled" type="button" name="invite" value="Send"> 所以,正如你们看到的那个样,这个按钮被禁用了,你们不能点击,你们必须先写下你们的名字和邮件,在那个

由于.prop(“disabled”,false)有问题,它在opera和firefox中运行良好,但IE和chrome我无法让它运行

事实上,这是一个邀请表,我会像这样做发送按钮

<input id="sendInvite" class="mail_send" disabled="disabled" type="button" name="invite" value="Send">
所以,正如你们看到的那个样,这个按钮被禁用了,你们不能点击,你们必须先写下你们的名字和邮件,在那个按钮被禁用后,你们才能发送邮件。 对于此im,请编写以下代码:

但这里有点不对劲,在chrome和IE disabled从未从按钮中删除,im也加载了jquery 1.7.1


p、 it’我的英语很抱歉,试着这样写:

$('myButton').prop("disabled", "");

只需使用按钮和live:

<button class="sendm">Send Email</button>

$(".sendm").live("click", function(e){
   var field1 = $("").val();
   var field2 = $("").val();

   if(field1 === "" || field2 === "" ){
    /// fake checker, you make this more robust etc
     return false;  // maybe do an alert here
   } else {
      //post form data and get json response
   }

});

 $(document).ready(function(){ $(".sendm").button(); });
发送电子邮件
$(“.sendm”).live(“单击”),函数(e){
var field1=$(“”).val();
var field2=$(“”).val();
如果(字段1==“”| |字段2==“”){
///假棋盘格,你让它更坚固等等
return false;//可能在此处执行警报
}否则{
//发布表单数据并获取json响应
}
});
$(document).ready(函数(){$(“.sendm”).button();});
删除属性:

$('button').removeAttr("disabled");

有关更多详细信息,请参见。您的问题不在于JQuery,而在于CSS选择器。disabled属性指的是页面首次加载时的默认值,而不是元素是否实际被禁用

您需要的CSS选择器是:


您可以看到一个例子。

我遇到了一个类似的问题,我使用.prop(“disabled”,false)从“Save”按钮中删除disabled。Disabled是通过.prop分配的(“Disabled”,true)

但是等等,当我试图删除这个属性(在html标记中会被呈现为禁用)时,我发现它被输出为class=“disabled”

为此,我使用了.removeClass('disabled') 我想说的是,如果事情没有按照你认为应该的方式进行,确保它们的初始输出是你期望的



我在chrome 17中使用了这两种方法,它们都能工作。我想你的问题可能出在其他地方,你在控制台上有什么错误吗?很有趣。。在JSFIDLE上的Chrome16上对我也有效,在现场不起作用。控制台中没有错误。嗯,小提琴的链接断了
$('button').removeAttr("disabled");
.mail_send:disabled {background-color:#343434; color:#747474}