Im building a menu dynamically and then a sub menu inside this dynamically also.
The submenu is hidden and then when the user hovers over te main menu link the submenu appears.
what i need to do is if the sub menu li has a class ‘on’ then i need that submenu ul to be given the attr visible or display block?
so i need some sort of jquery when the page loads if the submenu contain li with class on then that submenu gets the attr visible?
This is my menu:
<div class="sideMenu2">
<ul>
<li><a href>retail</a>
<ul class="subsideMenu2">
<li class= "on"><a href="/portfolio/5/0">cabot circus</a></li>
<li><a href="/portfolio/6/0">st. stephen's</a></li>
<li><a href="/portfolio/7/0">silverburn</a></li>
<li><a href="/portfolio/8/0">the elements</a></li>
</ul>
</li>
<li><a href>sports & leisure</a>
<ul class="subsideMenu2">
<li><a href="/portfolio/19/0">test</a></li>
</ul>
</li>
</ul>
</div>
1 Answer