Try the following:
$(this).parent('h3').siblings('h3').children('span').addClass('active'); $(this).parent('h3').siblings('h3').next('div.container').slideToggle('active');
That should do the trick!
However, can I assume that you will have only one active?
If so, this is easiest:
$('.active').removeClass('active').parent('h3').next('div.container').slideUp();
Hope that helps :)
change
To be smarter, keep active as a variable. So click:
$active = $(this);
Then, the next time you can do this without receiving jQuery to find the element again:
$active.removeClass('active').parent('h3').next('div.container').slideUp(); $active = $(this);
will source share