jQuery snippet:
$(".sliders dt a").click(function(){
$(this).parent().parent().parent().find(".triggers a").removeClass("active");
$(this).toggleClass("active");
$(this).parent().next("dd").slideToggle("fast");
return false
});
HTML:
<div class="sliders">
<div class="triggers">
<a href="#" class="active">Hide all</a>
</div>
<dl>
<dt>
<a href="#">text</a>
</dt>
<dd>text</dd>
</dl>
</div>
Three .parent()
is used, to catch .triggers
block. Is there any way to merge them?
jQuery 1.2.6. version is used, thats why .closest()
solutions don't work.