Reputation: 4987
I want to change the background color of a link with jQuery, the orginal CSS for the link is
#container ul li:hover ul li a{
background: #FF0000
}
I'm trying the following jQuery code, but it does not seem to work.
jQuery('#container ul li:hover ul li a').css('background', '#FF0000');
I can set the css for the normal links, but its only causing problem with the link hover.
Upvotes: 0
Views: 94
Reputation: 829
You could try it with the jquery hover function. http://api.jquery.com/hover/ And re-set the color.
Upvotes: 0
Reputation: 15338
try this:
jQuery('#container ul li ul li a').hover(function(){
$(this).css('background', '#FF0000');
})
or this :
jQuery('#container ul li').hover(function(){
$(this).find("ul li a").css('background', '#FF0000');
})
Upvotes: 3