jq实现点击某元素之外触发事件

废话不多说,直接上代码!

1 $(document).bind("click",function(e){
2         var target = $(e.target);
3         if(target.closest("#parentId").length == 0){//点击id为parentId之外的地方触发
4             layer.close(tip_index);
5             type=0;
6         }
7 })
原文地址:https://www.cnblogs.com/xujingyang/p/7607652.html