jquery 判断点击对象是否在元素内部

<div class="box2">
            <div class="inbox" style="height: 80px;background: #eee;">4</div>
</div>

$(document).on('click',function(e) {
            console.log($(e.target).closest('.box2').length);
})

猜你喜欢

转载自blog.csdn.net/guohao326/article/details/86230009
今日推荐