点击除指定元素以外的任意地方隐藏js

    $(document).click(function () {
        $(".search_box").hide();
    });
    $(".resultUl").on("click", function (event) {
        //取消事件冒泡
        var e = arguments.callee.caller.arguments[0] || event;
        if (e && e.stopPropagation) {
            // this code is for Mozilla and Opera
            e.stopPropagation();
        } else if (window.event) {
            // this code is for IE
            window.event.cancelBubble = true;
        }
    });

 

posted on 2018-09-01 15:19  creatP  阅读(552)  评论(0编辑  收藏  举报

导航