Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 444
  • Last Modified:

jQuery hover: child

Hi,

If I have a <ul> with class "nav" can someone quickly tell me what's the jQuery equivalent to this css (which of course doesnt work in IE6):

I am using this for a drop down menu - when you hover over a menu item with a drop down list, the main menu item should remain highlighted.

.nav li:hover > a  {
    background:red;
   color:white;
}

Cheers,

Daisy
0
daisydoos
Asked:
daisydoos
1 Solution
 
Albert Van HalenCommented:
Use the hover method : Using two anonymous functions : one for mouseover 1 for mouseout
$(".nav li").hover(
	function() {
		$(this).children("a").css({ "backgroundColor" : "red", "color" : "white" });
	},
	function() {
		$(this).children("a").css({ "backgroundColor" : "", "color" : ""});
	}
);

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now