Wednesday 28 August 2013

Trying to chage UL LI backgroud color jquery

Trying to chage UL LI backgroud color jquery

I am trying to change the clicked UL LI link with jquery; it only works
with hover event, not with click event. Please see my code below:
$("nav ul li").hover(function() {
$(this).find('a').css('color', '#FF0');
}, function() {
$(this).find('a').css('color', '#FFF');
});
$("nav ul li").click(function() {
$(this).find('a').css('color', '#FF0');
$(this).find('a').siblings().css('color', '#FFF');
});

No comments:

Post a Comment