jQuery parent()
Posted
by Happy
on Stack Overflow
See other posts from Stack Overflow
or by Happy
Published on 2010-05-11T19:47:23Z
Indexed on
2010/05/11
19:54 UTC
Read the original article
Hit count: 180
jQuery snippet:
$(".sliders dt a").click(function(){
$(this).parent().parent().parent().find(".triggers a").removeClass("active");
return false
});
HTML:
<div class="triggers"><a href="#" class="active">Hide all</a></div>
<dl class="sliders">
<dt><a href="#">text</a></dt>
<dd>text</dd>
</dl>
Three .parent()
is used, to catch .triggers
block. Is there any way to merge them?
© Stack Overflow or respective owner