jQuery实现点击空白关闭目标元素的方法

$(document).click(function(e){  
  var _con = $('目标区域');   // 设置目标区域</span>  
  if(!_con.is(e.target) && _con.has(e.target).length === 0){ // 点击区域不是目标本身,也排除目标区域的子元素
    some code...   // 功能代码  
  }  
}); 
原文地址:https://www.cnblogs.com/luna666/p/9233432.html