js如何点击父级元素关闭,点击子级不受影响

$(".parent").on("click", function() {//点击父级元素关闭
    $('.parent').hide();
});
$(".parent").on("click", ".son", function(e) {//点击子级不受影响
    e.stopPropagation()
})

猜你喜欢

转载自blog.csdn.net/m0_37285193/article/details/103101841