My code is:
JavaScript:
$(".Head").click(function () {
if ($(".Body").is(":hidden")) {
$(".Body").slideDown('fast');
} else {
$(".Body").slideUp('fast');
}
});
HTML:
<div class="Head">
Heading
</div>
<div class="Body">
Content
</div>
Now my problem is i have multiple div tags in the similar name and format the Head and Body
class is repeated and when i click one Head section it slides up all of them how can i make them slide up and down there particular Body class?
You were really close. Here is a jsfiddle which does what you need it to do.
http://jsfiddle.net/Sze8D/
You need to just grab the next body after the heading you clicked by using
.next()