Solved

jQuery hover: child

Posted on 2009-07-13
1
435 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

This article discusses how to create an extensible mechanism for linked drop downs.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now