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
$(window).click in IE doesn't work
提问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 click
event.
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(........