单击div外部或单击后代时隐藏div

时间:2019-12-09 12:01:41

标签: jquery hide

所以我看到了这个post并注意到了这个answear

 $(document).mouseup(function(e) 
{
    var container = $("YOUR CONTAINER SELECTOR");

    // if the target of the click isn't the container nor a descendant of the container
    if (!container.is(e.target) && container.has(e.target).length === 0) 
    {
        container.hide();
    }
});

但是,单击后有可能使容器的后代隐藏容器吗?

0 个答案:

没有答案