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

后端 未结 4 1555
忘了有多久
忘了有多久 2021-02-11 22:44

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



        
4条回答
  •  情深已故
    2021-02-11 23:23

    Try:

    event.originalEvent.defaultPrevented
    

    As in:

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

提交回复
热议问题