I have troubles to show an alert when a button (actually an input type=image object) is disabled because user should first to click on a terms checkbox.
(当用户禁用按钮(实际上是输入类型=图像对象)时,我很难显示警报,因为用户应该首先单击术语复选框。)
This is my jQuery code:(这是我的jQuery代码:)
$('#divButton').on("click", function() {
if ($('#buybutton').prop('disabled', true)) {
alert('Please confirm . . .');
}
});
And this is the HTML code:
(这是HTML代码:)
<form>
...
<div id="divButton">
<input type="image" id="buybutton"...
</div>
</form>
When buybutton
is disabled and I click inside divButton
(over disabled button for example) nothing happens.
(当buybutton
被禁用并且我在divButton
内部divButton
(例如,在禁用按钮上),什么也没有发生。)
I am a mobile developer trying to write JavaScript code, so be patient with me.
(我是一位尝试编写JavaScript代码的移动开发人员,所以请耐心等待。)
What am I doing wrong?
(我究竟做错了什么?)
EDIT: Debugging it on Chrome, when buybutton
is disabled it is never entering inside divButton's click handler function to check
(编辑:在Chrome上调试它,禁用buybutton
时,它永远不会进入divButton的click handler函数中进行检查)
if ($('#buybutton').prop('disabled', true)).
Looks like onClick event in that div be disabled.
(看起来该div中的onClick事件被禁用。)
ask by lm2a translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…