gpt4 book ai didi

javascript - jquery 获取最近的 parent

转载 作者:数据小太阳 更新时间:2023-10-29 04:59:27 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
nearest ancestor node in jQuery

html:

<div class="post">
<h2><a href="#" title="">Pellentesque</a></h2>
<p><a href="#" title="" class="more">More</a></p>
</div>

jQuery

$('.more').bind("hover", function(){
$(this).parent('.post').hide() ;
});

在悬停 (.more) 时我想隐藏帖子,但它什么也没做如果我改用 parents() 它会删除页面上的所有 .posts

感谢任何帮助

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com