body 点击事件 排除局部元素

body 点击事件 排除局部元素

$('body').click(function (e) {
    if (e.target.className == 'cuttomBtnText' || $(e.target).hasClass('barQrcode') || $(e.target).parents('.barQrcode').length > 0) {
       return;
    }
    // ...
});

 

这个很常用,帮过我的大忙,常常用到的时候找不到。

posted on 2020-01-07 11:01  独自去流浪  阅读(1104)  评论(0)    收藏  举报