body 点击事件 排除局部元素

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

 

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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-09-10
  • 2023-01-22
  • 2022-12-23
相关资源
相似解决方案