I need help on understanding the class selector code. Currently I have these:
<div class="tt-news">
<div class="tt-news-top">
<a class="tt-news-img custom-hover" href="http://www.cfbtvideos.org/cfbt/2017/10/11/puppet-workshop/"><img alt="" class="img-responsive wp-post-image" height="168" sizes="(max-width: 360px) 100vw, 360px" src="http://www.cfbtvideos.org/cfbt/wp-content/uploads/2017/10/Article-2.jpg" srcset="http://www.cfbtvideos.org/cfbt/wp-content/uploads/2017/10/Article-2.jpg 750w, http://www.cfbtvideos.org/cfbt/wp-content/uploads/2017/10/Article-2-300x140.jpg 300w" width="360"></a>
<div class="tt-news-date" style="display: block;">
<span>11</span> Oct
</div>
</div>
<div class="tt-news-label">
<span>By: <a>cfbt admin</a></span>
</div><a class="tt-news-title c-h6" href="http://www.cfbtvideos.org/cfbt/2017/10/11/puppet-workshop/" style="display: block;">Puppet Workshop</a>
<div class="simple-text size-4">
An optional PD session entitled “Making a Bruneian Student Finger Puppet” was held on Wednesday ...
</div>
Im trying to show the .tt-news-date span and .tt-news-label .tt-news-title on hovering the .custom-hover
Right now, I have this code:
jQuery(document).ready( function( $ ) {
var posthover = $(".custom-hover.custom-hover");
$(posthover).hover( function() {
$(".tt-news-date").css("display", "block");
$(".tt-news-title").css("display", "block");
});
});
But this will show all of the title and date on hovered. I just need to show the closest to the one's I hovered. How do I do this?
.closest()jQuery method.