Use of getPreventDefault() is deprecated. Use defaultPrevented instead. Why I'm getting this error and what's the solution for it?

PHPLover picture PHPLover · Oct 3, 2014 · Viewed 80.1k times · Source

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?

Due to this error my other jQuery functionality is also not working.

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.

Answer

cuth picture cuth · Nov 6, 2015

Try:

event.originalEvent.defaultPrevented

As in:

$(document).on('click', function (e) {
    if (e.originalEvent.defaultPrevented) return;
    // continue
});