Skip to content

Instantly share code, notes, and snippets.

@fieldoffice
Created March 16, 2015 12:35
Show Gist options
  • Save fieldoffice/ea35b11da55d4c964815 to your computer and use it in GitHub Desktop.
Save fieldoffice/ea35b11da55d4c964815 to your computer and use it in GitHub Desktop.
Toggle Text (Accordion)
$('.toggle').click(function() {
var txt = $(this).next('ol').is(':visible') ? '+' : '-';
$(this).find('span').text(txt);
$(this).next('ol').slideToggle();
});
<h3 class="toggle">Header <span>-</span></h3>
<ol>
<li>Option 01</li>
<li>Option 02</li>
<li>Option 03</li>
</ol>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment