how can I store a newly appended element into a variable?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1162677/how-can-i-get-a-reference-to-a-node-directly-after-it-is-appended">How can I get a reference to a node directly after it is appended?</a>  </p>
</blockquote>



<p>as an example:</p>

<pre><code>$(document).append('&lt;div class="new-elem" /&gt;');
</code></pre>

<p>how do i now store the above newly created element into a variable so i can use it like this:</p>

<pre><code>newElem.append('div class="another-new-element" /&gt;');
</code></pre>

<p>where newElem is the element i appended to the document initially?</p>

<p>i'm assuming it can't be done like:</p>

<pre><code>var newElem = $(document).append('&lt;div class="new-elem" /&gt;');
</code></pre>
