認(rèn)證高級(jí)PHP講師
You should look like this
$(document).bind("click",function(e){
//通過(guò)e.target判斷
}
e.target != "You click on the element that needs to be displayed" then execute hide()
$("#a").on("click", function(e){
if($(".class").is(":hidden")){
$(".class").show();
}else{
$(".class").hide();
}
$(document).one("click", function(){
$(".class").hide();
});
e.stopPropagation();
});
$(".class").on("click", function(e){
e.stopPropagation();
});
There is no problem with this answer, it is quite correct