$(document).on('click',function(){
var target = e.target;
if($(target).parents(".chatMessage").length == 0){ $('.detailsMessage').hide(); }});//寻找点击的目标是否在这个DIV内就OK了。网上不少用阻止冒泡的方式作的,可是一旦在这个DIV里面有绑定了document的事件,那么这个事件也一块儿被阻止了。