我在使用 IE8 中的 jQuery 连接窗口的 mousedown
事件时遇到问题。我没有收到任何错误,但该事件似乎并未触发。它在 IE9 和我尝试过的所有其他浏览器中都有效。这是我的代码:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
function test(e) {
alert('test');
}
$(document).ready(function () {
$(window).mousedown(test);
});
</script>
</head>
<body>
</body>
</html>
最佳答案
使用文档
代替窗口
$(document).ready(function() {
$(document).mousedown(function() {
alert('test');
});
});
关于javascript - jQuery mousedown 事件不会在 IE8 中为窗口触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8413958/