I have the following:
<div class="container">
Test 1
<div class="child">Testing</div>
</div>
<div class="container">
Test 2
<div class="child">Testing</div>
</div>
<div class="container">
Test 3
<div class="child">Testing</div>
</div>
I wish to have the child div inside the container thats hovered over to show and hide when the mouse has left the container.
I do currently have:
$('.container').hover(
function () {
$(this).next('.child').show();
},
function () {
$(this).next('.child').hide();
}
);
However it does not seem to work.
Any advice appreciated, thanks.
use find() instead of next as it is a child element and not a sibling one: