jQuery equivalent to `return document.getElementById(theVar)'
<p>I've a javascript function</p>

<pre><code>function $m(theVar){
    return document.getElementById(theVar)
}
</code></pre>

<p>The problem with the above code is, the element I want to pass is generated by ajax so I need something like the <code>.live()</code> in jquery, unless it throws an error</p>

<p>How do I rewrite the above function in jQuery so that any DOM element generated later can also be detected.</p>

<p>Update:</p>

<p>When my page first load, it loads </p>

<p>1) ajaxupload.js with codes </p>

<pre><code>function ajaxUpload(form,url_action,msg){
   var id_element= "pop-con";
   function $m(theVar){
        return document.getElementById(theVar)
    }
   if($m(id_element)==null){
        erro += "The element of 3rd parameter does not exists.\n";
    }
}
</code></pre>

<p>2) index.php with codes</p>

<pre><code>&lt;div id="popupMargin"&gt;
    &lt;div class="close"&gt;x&lt;/div&gt;
    &lt;div id="pop-con"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div id="ajaxGenerateMarkUp"&gt;&lt;/div&gt;
</code></pre>

<p>3) now on the click of a button, the following markUp is added to the <code>#ajaxGeneratedmarkUp</code> div (mark-up generated through ajax)</p>

<pre><code>&lt;form  onSubmit="return disableForm(this);" action="crop/wizecho_upload.php" method="post" name="f" id="wizecho" enctype="multipart/form-data"&gt;
      &lt;input id="file" type="file" name="file"  onChange="return disableForm(this), ajaxUpload(this.form,'crop/wizecho_upload.php', '&amp;lt;br&amp;gt;Uploading image please wait.....&amp;lt;br&amp;gt;'); return false;"/&gt;
&lt;/form&gt;
</code></pre>

<p>Now on change of this input type file, made the call on in the javascript. Now it shows the error.</p>

<p>[Note: I only posted sections of code I think might affect my question]</p>
