I'm using this on a page:
jQuery('.class1 a').click( function() {
if ($(".class2").is(":hidden")) {
$(".class2").slideDown("slow");
} else {
$(".class2").slideUp();
}
});
With a structure in the page later that goes like this:
<div class="class1">
<a href="...">text</a>
<div class="class2">text</div>
</div>
This is working fine, except when you have multipule class1/class2 sets like so:
<div class="class1">
<a href="...">text</a>
<div class="class2">text</div>
</div>
<div class="class1">
<a href="...">text</a>
<div class="class2">text</div>
</div>
<div class="class1">
<a href="...">text</a>
<div class="class2">text</div>
</div>
How do I change the initial jquery code so that it only effects the class 2 under the current class1 that was clicked? I've tried variations of what was recommended on this page but havent gotten it to work yet: http://stackoverflow.com/questions/306583/jquery-this-selector-and-children