This demo does not add class when you hover a list item.
What am I doing wrong here?
$("li").hover(
function () {
$(this).addClass('hover);
},
function () {
$(this).removeClass("hover");
}
);
html
<ul>
<li>Milk</li>
<li>Bread</li>
<li>Chips</li>
<li>Socks</li>
</ul>
css
.hover{
color:green;
font-size: 20px;
}
Thanks in advance.
Your JavaScript was badly formed:
Should be:
If you click on the
JS Lintbutton to the top of the screen it would’ve told you this (this isn’t intended as a criticism, just a note for your future use of JS Fiddle).