jquery - Expand months on click of year -


how can expand (and toggle) archivemenumonths on click of year link?

<div class="archivemenu">     <ul class="archivemenuyear">         <li class="year">             <a href="#">2016</a>         </li>     </ul>     <ul class="archivemenumonths">         <li class="month">             <a href="#">july</a>         </li>         <li class="month">             <a href="#">june</a>         </li>         <li class="month">             <a href="#">may</a>         </li>         <li class="month">             <a href="#">march</a>         </li>         <li class="month">             <a href="#">february</a>         </li>     </ul> </div> 

i have archivemenumonths set display:none;.

at moment doesn't seem fire:

$(function() {    $('.year a').click(function() {        $(this).next('.archivemenumonths').show();        return false;    });         }); 

it fires, selector show element wrong tho. archivemenumonths not next element relative clicked anchor - need go ul, next ul

$(this).closest("ul.archivemenuyear").next('.archivemenumonths').toggle(); 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -