Getting jQuery to work with if statement
<p>I'm pretty new to jQuery so I'm trying to get working a small piece of code.
I'm trying to create sort of an accordion menu. </p>

<p>First, (after looking at some tutorials) I did something very similar to what I wanted:</p>

<pre><code>&lt;script type="text/javascript"&gt;
$(document).ready(function(){
    $(".content").hide();
    mainmenu();
});

function mainmenu(){        
    $(".option").click(function(){
            $(".content").slideUp("slow");
            $(this).children("div.content").slideDown("slow");
    });
}
</code></pre>

<p></p>

<p>It worked fine but it did the "hide" + "show" animation if I clicked an opened option.</p>

<p>So, I tried to add a condition to get the menu doing what I wanted, but it doesn't work. Even the content hiding at the begining now doesn't work.</p>

<p>The piece of code that now doesn't work is this one:</p>

<pre><code>&lt;script type="text/javascript"&gt;
$(document).ready(function(){
    $(".content").hide();
    mainmenu();
});

function mainmenu(){        
    $(".option").click(function(){
            if (($(this).children("div.content").is(":hidden")){
                $(".content").slideUp("slow");
                $(this).children("div.content").slideDown("slow");
            }else{
                $(".content").slideUp("slow");
            }
    });
}
</code></pre>

<p></p>

<p>So, if the content is not hidden, it should just hide the content instead of hide and show again.</p>

<p>I don't know if I'm approaching the problem in a bad way or what. I'm very new to this.</p>

<p>If somebody can help me, I will really appreciate it.</p>

<p>Thanks.</p>

<p><strong>EDIT: I missed one parenthesis at the if statement. It's now working! BTW thank you very much</strong></p>
