不推荐使用 getPreventDefault().请改用 defaultPrevented.为什么我会收到此错误,解决方法是什么? [英] Use of getPreventDefault() is deprecated. Use defaultPrevented instead. Why I'm getting this error and what's the solution for it?
本文介绍了不推荐使用 getPreventDefault().请改用 defaultPrevented.为什么我会收到此错误,解决方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以前我在我的代码中使用 jQuery 1.7.1.我收到了上述错误.然后我直接从谷歌存储库中使用了 jQuery 1.11.1
Previously I was using jQuery 1.7.1 in my code. I was getting the above error. Then I used the jQuery 1.11.1 straight from the google repository
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.1.min.js">
</script>
但我仍然收到此错误.我应该如何解决这个问题?
but still I'm getting this error. How should I resolve this?
由于这个错误,我的其他 jQuery 功能也无法正常工作.
Due to this error my other jQuery functionality is also not working.
我对解决方案进行了很多研究,但每次我都得到相同的升级 jQuery 版本的解决方案.但这也不适合我.
I researched a lot about the solution but every time I got the same solution of upgrading the jQuery version. But this is also not working for me.
推荐答案
试试:
event.originalEvent.defaultPrevented
如:
$(document).on('click', function (e) {
if (e.originalEvent.defaultPrevented) return;
// continue
});
这篇关于不推荐使用 getPreventDefault().请改用 defaultPrevented.为什么我会收到此错误,解决方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文