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

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -