I’ve got a list which i want to have a share/delete showing on hover
<ul class="folder-items">
<li><a href="">This</a></li>
<div class="folder-hover"><a href="">share</a><a href="">delete</a></div>
<li><a href="">That</a></li>
<div class="folder-hover"><a href="">share</a><a href="">delete</a></div>
<li><a href="">Other</a></li>
<div class="folder-hover"><a href="">share</a><a href="">delete</a></div>
</ul>
but it is targeting all of the .folder-hover when I hover over the .folder-items a
How do I get it so it only toggles the div on that specific li element
my current jquery is
$(document).ready(function () {
$('.folder-items a').hover(function(){
$('.file-hover').toggle();
});
});
First off, your markup is invalid (
divcannot be a direct child oful). If you fix that, you can usesiblingsto select the appropriatefolder-hover:HTML:
JavaScript: