I'm trying to see if the the child div of an li is visible and if so apply a class to the li. This is what I got but it's not working.
if(jQuery('#menu li').children('div').css('display') != 'none') {
jQuery('li', this).addClass('dropHover');
}
jquery
I'm trying to see if the the child div of an li is visible and if so apply a class to the li. This is what I got but it's not working.
if(jQuery('#menu li').children('div').css('display') != 'none') {
jQuery('li', this).addClass('dropHover');
}
Best Solution
I don't know what is the DOM structure or to what
this
refers to, but this might do the trick as well:It adds the class "dropHover" to all
<li>
elements that have a visible<div>
and they need to be children of an element with the menu id.