I dont know what is the problem with this ?
$('.post').live('mouseenter mouseleave', function() {
$(this).filter('anything here,a,div,.class,#id').toggleClass('hidden');
});
where as this works fine.
$('.post').live('mouseenter mouseleave', function() {
$(this).toggleClass('hidden');
});
There is an anchor which I would like to show on mouse hover. Similar to Facebook
$(this)refers to your.postelement..filter()removes anything that does not match the selector.So in your given example if the
.postelement is not one of the followingit gets filtered out.
.filter()doesn’t traverse. It takes a jQuery set and reduces it to the elements that match the selector given.http://api.jquery.com/filter/
EDIT:
There are lots of ways to traverse in jQuery.
http://api.jquery.com/category/traversing/
To get all the
aelements that are descendants of the.postelement that received the event, you could do:Which traversal method to use will depend on your situation.