jQuery $(window).click 在 IE 中不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4820863/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 17:59:22  来源:igfitidea点击:

$(window).click in IE doesn't work

jquery

提问by meijiOrO

Why is it $(window).click doesn't work in IE. It works is all other browsers. (I can't use body or document in my page since something else in the page interferes with it.

为什么 $(window).click 在 IE 中不起作用。它适用于所有其他浏览器。(我无法在我的页面中使用正文或文档,因为页面中的其他内容会干扰它。

$(window).click(function() {
        do stuff
    });

回答by user113716

It is simply not supported in IE.

它在 IE 中根本不受支持。

Here's a compatibility listof browsers' support for the clickevent.

是浏览器对该click事件的支持的兼容性列表

You'll see that IE does not support it on the window.

您会看到 IE 在window.

I'd be curious to know what you mean when you say "I can't use body or document in my page since something else in the page interferes with it."

当您说“我无法在我的页面中使用正文或文档,因为页面中的其他内容会干扰它”时,我很想知道您的意思

回答by Valentin Kantor

try $(document).click(........

试试 $(document).click(........