不建议使用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.我收到上述错误. 然后我直接从Google存储库中使用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屋!
查看全文