javascript - jquery help with next() function -
i have html markup looks this,
</a> <nav> <ul> <li><a href=""><img src="/media/icons/view.jpg" alt="views"/> 210</a></li> <li><a href=""><img src="/media/icons/like.jpg" alt="likes"/> 45</a></li> <li class="jobs"><a href="">52 new jobs</a></li> </ul> </nav> <ul class="job_listings"> <li><a href="">outbound telesales assistant ></a></li> <li><a href="">business development manager ></a></li> </ul </li> the .job_listings hidden on dom ready , needs show when li.jobs a clicked, have tried following, jquery:
$('#jobwall .jobs a').click(function(){ $(this).next('.job_listing').show(); return false; });
you should next element of nav element , not anchor, , missing s in .job_listing selector.
try this:
$('#jobwall .jobs a').click(function(){ $(this).closest("nav").next('.job_listings').show(); return false; });
Comments
Post a Comment