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() ;
});
on hover (.more) i want to hide the post, but it does nothing if i use parents() instead it deletes ALL the .posts on the page
any help appreciated
Try
$('.more').bind('hover',function()
{
$(this).closest('.post').hide();
});
here is the working demo with single class.
here is the demo with multiple classes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With