$("#errorMsg_layer").bind("click",function(e){ if($(e.target).closest("#errorMsg_div").length == 0){ foo(); } });//点击 #errorMsg_div 之外触发foo()方法。