Solved

jQuery hover: child

Posted on 2009-07-13
1
438 Views
Last Modified: 2012-05-07
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
Comment
Question by:daisydoos
1 Comment
 
LVL 19

Accepted Solution

by:
Albert Van Halen earned 500 total points
ID: 24838562
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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question