Changing the child element's CSS when the parent is hovered Changing the child element's CSS when the parent is hovered jquery jquery

Changing the child element's CSS when the parent is hovered


Why not just use CSS?

.parent:hover .child, .parent.hover .child { display: block; }

and then add JS for IE6 (inside a conditional comment for instance) which doesn't support :hover properly:

jQuery('.parent').hover(function () {    jQuery(this).addClass('hover');}, function () {    jQuery(this).removeClass('hover');});

Here's a quick example: Fiddle


No need to use the JavaScript or jquery, CSS is enough:

.child{ display:none; }.parent:hover .child{ display:block; }

SEE DEMO


.parent:hover > .child {    /*do anything with this child*/}