gpt4 book ai didi

jquery - 如何在jquery中设置禁用按钮的事件?

转载 作者:行者123 更新时间:2023-12-01 05:36:33 24 4
gpt4 key购买 nike

如何在 jquery 中设置禁用按钮的事件。我想在鼠标进入禁用按钮时显示一条消息。但现在当鼠标进入禁用按钮时,没有事件不发生。

最佳答案

尝试这样:

<div id="myid"><input type="submit"><div>

$('myid').click(function(event){
if (attr('submit-button', 'disabled') == 'true')
{
alert('The button is disabled')
}
});

另请检查此 forum :

Firefox, and perhaps other browsers, disable DOM events on form fields that are disabled. Any event that starts at the disabled form field is completely canceled and does not propagate up the DOM tree. Correct me if I'm wrong, but if you click on the disabled button, the source of the event is the disabled button and the click event is completely wiped out. The browser literally doesn't know the button got clicked, nor does it pass the click event on. It's as if you are clicking on a black hole on the web page.

关于jquery - 如何在jquery中设置禁用按钮的事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33686961/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com