点击除指定元素以外的任意地方隐藏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;
        }
    });

猜你喜欢

转载自www.cnblogs.com/creatP/p/9570520.html
今日推荐