点击指定元素区域之外的地方

点击一个元素之外的地方,需要呈现某特定效果的方法:

 $(document).click(function(e){
        var _con = $('.selectinput');   // 设置目标区域
        if(!_con.is(e.target) && _con.has(e.target).length === 0){
            $(".datalist").hide();//点击的动作
        };
    });
原文地址:https://www.cnblogs.com/zjingjing/p/7768952.html