I have a sidebar menu, and using js code active item has different background and font color. It works, but after clicking on any item, css line marked bellow as line x - doesn't more work. Why is it lost. In js code I didn't touch :hover state at all ?
<div id="divL">
<div id="sky">SKY</div>
<div id="sea">SEA</div>
<div id="universe">UNI-VERSE</div>
</div>
css
#divL div{
margin:3px 0;
padding:5px 14px;
cursor:pointer;
}
#divL div:first-of-type {
background:#ffffff;
color:#008080;
}
#divL div:hover{ // line x
background:#ffffff;
color:#008080;
}
JS
$("#divL div").click(function () {
$('#divL div').css({'background':'#008080', 'color':'#ffffff'})
$(this).css({'background':'#ffffff', 'color':'#008080'})
});