I have headers, and each of those headers has sub items. When I click a header, I want it to toggle viewing or showing the headers contents:
This is what I have so far:
$j('h2').click(function() {
if ($j(this).next().is(":hidden")) {
$j(this).next().show();
} else {
$j(this).next().hide();
}
});
And my HTML look like this:
<ul class="submenu">
<li class="section"><h2>Section One</h2>
<ul>
<li>text</li>
<li>text</li>
<li>text</li>
</ul>
</li>
<li class="section"><h2>Section Two</h2>
<ul style="display: none; overflow-x: visible; overflow-y: visible; ">
<li style="">
text</li><li>
text</li><li>
text</li></ul>
</li>
</ul>