I have the following html:
<div class="container">
<div class="link"><a>Link</a></div>
</div>
with the following css:
.link a {
padding-left: 30px;
position: relative;
}
.link a:before {
content: "+";
display: inline-block;
left: 0;
position: absolute;
top: 0;
}
I'd like to add a class to the parent container if I hover just on a:before
with jquery. I tried the following code, but I can't understand why this is not working:
$('.link a:before').hover(function () {
$(this).parent('.container').addClass("selected");
});
Does anyone know what I'm doing wrong?