Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.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 在Mozilla上单击(禁用)未触发的输入_Javascript_Jquery - Fatal编程技术网

Javascript 在Mozilla上单击(禁用)未触发的输入

Javascript 在Mozilla上单击(禁用)未触发的输入,javascript,jquery,Javascript,Jquery,当我在Chrome上点击一个禁用的输入时,它会给我想要的结果,但在Mozilla中,由于禁用了类,它不会呈现任何内容。我该怎么做才能让它工作 <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> $(document).ready(function(){

当我在Chrome上点击一个禁用的输入时,它会给我想要的结果,但在Mozilla中,由于禁用了类,它不会呈现任何内容。我该怎么做才能让它工作

<head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script>
        $(document).ready(function(){
            $(".divclick").click(function(){
                alert("jsk");
            });
        });
    </script>
</head>
<body>
    <div class="divclick" height="100px" width="100px" style="background:red;">
        <input type="text" disabled>
    </div>
</body>

$(文档).ready(函数(){
$(“.divclick”)。单击(函数(){
警报(“jsk”);
});
});

附言:我已经试过用包装纸包起来了。我希望只有所需的输入

我遇到了这个线程

消息来源在这里


这是一个

,只是因为它是一个不同的组件,事件是分开的。请看这里:@acarlon感谢您的帮助,但不幸的是,我的处理程序不在包装器(div)上,而是在输入本身上。我不打算使用wrap@user1560148您必须使用一种变通方法,因为firefox不会在禁用的输入上发出鼠标事件。Chrome对其他类型也有同样的作用,例如
type=“checkbox”
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.