How to assign and work with DOM elements as variables
<p>I would like to be able to assign an html element to a variable and then to work with it just like I'm working with the actual DOM element. </p>

<p>In this example, I want it so when showAlert() function gets called, it'll take the ID that is being passed, show the div, since it's default is hidden and set a text value inside the DIV. </p>

<p>What is the best way to do this?</p>

<p>HTML:</p>

<pre><code>&lt;div class="alert" id="myCustomAlert12345" style="display:none" &gt;
&lt;/div&gt;
</code></pre>

<p>Javascript:</p>

<pre><code>function showAlert(alertDivID, alertMessage, alerttype){        
        if(alertDivID&amp;&amp; alertMessage){
            currentDiv = $('#'+alertDivID);             
            currentDiv.show();
            currentDiv.html(alertMessage);
        }
}

showAlert("myCustomAlert12345","some error message goes here","error");
</code></pre>
