Selecting / operating on multiple elements

Selecting / operating on multiple elements

Hi All,

I am creating an FAQ type page with rows of questions that will drop down the respective answer when clicked.  I have it mostly working, except I can't find a way to close all answers before opening the next one.  I have tried everything I can think of (or search), but to no avail.  I am using the following code, where QQQ1/2 are the questions, and AAA1/2 are the answer divs:

  1. //Question/Answer
  2. $(".QQQ1,.QQQ2").click(function () {
  3. // check the visibility of the next element in the DOM

  4. if ($(this).next().is(":hidden")) {
  5. $(this).next().slideDown("fast"); // slide it down
  6. } else {
  7. $(this).next().hide("fast"); // hide it
  8. }
  9. });
  10. $(".AAA1,.AAA2").click(function () {
  11. $(this).hide("fast"); // hide it
  12. });

On that note, I found this code in the jQuery tutorials which claims better performance for this application, but like everything else I can't get it working.  
$('#faq').find('dd').hide().end().find('dt').click(function() { $(this).next().slideToggle()
Any suggestions to resolving my woes, or even a push in the right direction would be greatly appreciated!  

Thanks