JQuery vs GetElementById
<p>I'm trying to do something since yesterday, and I'm really stuck. 
Here is what « works » for now :</p>

<pre><code>&lt;h1 onclick="functionToggle(&lt;?php echo "'".$base."'" ?&gt;)"&gt; &lt;?php  echo $base ?&gt;&lt;/h1&gt;
</code></pre>

<p>which echo :</p>

<pre><code>&lt;h1 onclick="functionToggle('helpers')"&gt; helpers&lt;/h1&gt;
</code></pre>

<p>And I have a div like this one :</p>

<pre><code>&lt;div id="helpers" class="hidden"&gt;
    &lt;div class="fichier"&gt;audio_extensions March 02 2013 23:35:36.&lt;/div&gt;
    &lt;div class="fichier"&gt;ebook_extensions March 02 2013 19:42:55.&lt;/div&gt;
    &lt;div class="fichier"&gt;movie_extensions March 02 2013 20:28:01.&lt;/div&gt;
    &lt;div class="fichier"&gt;zip_extensions March 02 2013 19:50:21&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>The thing is : With this function, in JS :</p>

<pre><code>&lt;script&gt;
    function functionToggle(elem){
        etat=document.getElementById(elem).style.display;
        if(etat=="none"){
            document.getElementById(elem).style.display="block";
        }
        else{
            document.getElementById(elem).style.display="none";
        }
    }

 &lt;/script&gt;
</code></pre>

<p>This works. I just wanted to know how to do this with JQuery ? I have tried something like this :</p>

<pre><code>&lt;script&gt;
    function functionToggle(elem){
        $("#elem").toggle();
    }
 &lt;/script&gt;
</code></pre>

<p>and many other combinaison, but it doesn't work. I don't have any error, it simply doesn't work.</p>

<p>If you have a solution :)</p>

<p>Kai23</p>
