javascript - Toggle the nearest content when click on anchor using jQuery -
i have content structure this:
<a href="#" class="toggle_button">click me.</a> <p class="hidden_content">this content toggleable.</p> <a href="#" class="toggle_button">click me.</a> <p class="hidden_content">this different section.</p> <a href="#" class="toggle_button">click me.</a> <p class="hidden_content">this section different.</p>
i have discovered how make work 1 section, how can make when click on toggle_button opens nearest hidden_content class.
$('a.toggle_button').click(function() { $(this).next('p.hidden_content').toggle(); }
Comments
Post a Comment