Close button for div, accessing ID using Jquery
<p>I want to create a close button for some of my popup DIVs.
Each one pf them have a particular ID and my idea is to set the CSS 'display' to 'none', based on the Div ID being closed.</p>
<p>The following example is not working. I'm wondering why...</p>
<p>Java Script</p>
<pre><code>function CloseDiv(element) {
    var id = $(element).closest('div').attr('id')
    alert(id)  // It's returning the correct id
    $(id).css(&quot;display&quot;, &quot;none&quot;);
}
</code></pre>
<p>Html</p>
<pre><code>&lt;span id='close' onclick='CloseDiv(this)'&gt;x&lt;/span&gt;
</code></pre>