jquery - Toggle the visibility of an element -
i have following markup:
<a href="#" class="menu">menu</a> <ul> <li><a href="#">home</a></li> <li> <a href="#">content</a> <ul> <li><a href="#">files</a></li> <li><a href="#">posts</a></li> </ul> </li> <li><a href="#">shop</a></li> </ul>
1 - need toggle visibility of parent ul when first anchor (class="menu") clicked
2 - need toggle visibility of each child ul when anchor above clicked
how can jquery?
thank you, miguel
jquery(function(){ $('a[href="#"]').click(function(){ $(this).next('ul').toggle() }) })
Comments
Post a Comment