Demo of accordion-like behavior in JQuery
A trivial JQuery-based fiddle showing how nested lists can collapse and expand by clicking on elements in the outer list.
HTML
<p>Click on a country to see some states or provinces</p>
<ul>
<li><span class="country">México</span>
<div>
<li>Chiapas</li>
<li>Durango</li>
<li>Hidalgo</li>
</ul>
</li>
<li><span class="country">Pakistan</span>
<ul>
<li>پنجاب</li>
<li>سندھ</li>
<li>بلوچستان</li>
</ul>
</li>
<li><span class="country">Brasil</span>
<ul>
<li>Pará</li>
<li>Sergipe</li>
<li>Maranhão</li>
</ul>
</li>
</ul>
JavaScript
$("ul ul").hide("slow");
$(".country").click(function() {
$("ul ul:not(:hidden)").hide("slow");
$(this).next().show("slow");
});