Creating a popup message onClick with jQuery
<p>So I want, when "search" is clicked, a little bar comes down from the top of the page with the search form, and a close button. Clicking the bar to the close button slides the popup back above the page. he code is below, however my question is <strong>"How can I do this better? It currently seems very messy! Is there a way to not use that hidden div on the page, and have it created just when the function is run on click?"</strong></p>

<p>So it starts with an anchor that triggers a javascript function to topdown the search bar:</p>

<pre><code>&lt;a onClick="toggleSearch()"&gt;Search&lt;/a&gt;

function toggleSearch() {
    $('#searchoverflow').slideToggle('fast')
};
</code></pre>

<p>It toggles up and down a hidden div, <code>#searchoverflow</code> (this is what I'd like to get rid of).</p>

<pre><code>&lt;div class="notification" id="searchoverflow"&gt;
    &lt;a href="javascript:" onClick="toggleSearch()" style="width:100%; position:absolute;height:50px;"&gt;&lt;/a&gt;
    &lt;div style="width:0px"&gt;&lt;form style="width:200px" role="search" method="get" id="searchform" action="http://thenozzle.net/"&gt;&lt;input type="text" value="" name="s" id="s"&gt;&lt;input style="left:5px" type="submit" id="searchsubmit" value="Search"&gt;&lt;/form&gt;&lt;/div&gt;
    &lt;a href="javascript:" class="notificationclose" onClick="toggleSearch()"&gt;CLOSE&lt;/a&gt;
&lt;/div&gt;&lt;!-- searchoverflow --&gt;
</code></pre>

<p>he popup div explained: The notification class just styles it, it isn't related. The ID of search overflow is what I'm using in the javascript function, because I have other notifications on the page, and need to make this one specific. The first anchor inside the popup is what I'm using to make the search bar disappear when clicking its body. Below that, the other anchor is just  case people don't realize the entire thing will make is hide. The middle div just has the search form in it.</p>

<p>Thanks in advance!</p>

<p>tl;dr I'm trying to simplify the above code in any way possible to it's more semantic, less messy, and I don't have to use that hidden popup div in the html unless necessary.</p>
