Hey there, I'm a beginner and I'm facing an issue with selecting an element within my navigation list
<ul class="subnav">
<li><a href="#">Link 1</a><span class="sub">Description 1</span></li>
<li><a href="#">Link 2</a><span class="sub">Description 2</span></li>
<li><a href="#">Link 3</a><span class="sub">Description 3</span></li>
</ul>
I'm trying to develop a functionality that displays only the Description 1 text when a user hovers over Link 1.
Here is the JQUERY code I have written:
$('ul.subnav li a').hover(function() {
$('.sub').animate({opacity: "show", top: "5"}, "slow");
}, function() {
$('.sub').animate({opacity: "hide", top: "-5"}, "slow");
});
The issue I'm encountering is that when a user hovers over any link, all of the description text shows up. How can I instruct JQUERY to only show the Description of the link being hovered over?
Thank you for your help.