Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/460.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
Javascript 使用jQuery启用/禁用按钮(引导3)_Javascript_Jquery_Twitter Bootstrap - Fatal编程技术网

Javascript 使用jQuery启用/禁用按钮(引导3)

Javascript 使用jQuery启用/禁用按钮(引导3),javascript,jquery,twitter-bootstrap,Javascript,Jquery,Twitter Bootstrap,我有一个用Bootstrap3设计的按钮,不确定这是否真的重要 <button type="button" class="btn btn-danger" disabled="disabled" id="transmitDirectMail">Send</button> 问题是设置道具会启用按钮。('disabled',true)不会禁用按钮。这是因为您使用的是=(赋值运算符),而不是=或==进行比较 .done(function( msg ) { $("#tra

我有一个用Bootstrap3设计的按钮,不确定这是否真的重要

<button type="button" class="btn btn-danger" disabled="disabled" id="transmitDirectMail">Send</button>

问题是设置道具会启用按钮。('disabled',true)不会禁用按钮。

这是因为您使用的是
=
(赋值运算符),而不是
=
==
进行比较

.done(function( msg ) {
    $("#transmitDirectMail").prop('disabled', msg == "0");
});

这是因为您使用的是
=
(赋值运算符),而不是
=
==
进行比较

.done(function( msg ) {
    $("#transmitDirectMail").prop('disabled', msg == "0");
});

有时是简单的事情。只是我代码中的一个输入错误。谢谢你,有时候很简单。只是我代码中的一个输入错误。非常感谢。