Jquery closing in click
<p>im having a problem in a script that i download it in the web, basically what i need is a FAQ question whit the collapse panel interaction, but in this case different in the other out there i want when i click in one question it opens, and when i click in another question the question before closes and open the one i clicked.</p>

<p>I found this <a href="http://feloliveira.com.br/blog/faq-de-perguntas-e-respostas-com-jquery/" rel="nofollow">Collapse panel script</a></p>

<p>It works well, but is missing one detail, if i click in the same link (question), the question doesn´t collapse back to normal normal mode, its only possible to close him chosing another link. I want to be able to close the question when i chose another question and when i click the same question again.</p>

<p>the javascript code in the main page:</p>

<pre><code>&lt;script type="text/javascript"&gt;
&lt;!–
  $(function() {
    var $h2;
    var $answer;
    $(‘.answer’).hide();
    $(‘#faq h2′).bind(
        ‘click’,
        function()
        {
            if ($h2 &amp;&amp; $h2[0] != this) {
                $answer.slideUp();
                $h2.removeClass(‘open’);
            }
            $h2 = $(this);
            $answer = $h2.next();
            $answer.slideDown();
            $h2.addClass(‘open’);
        }
    )
 });
 –&gt;
&lt;/script&gt;
</code></pre>

<p>Hope for some help</p>
