jQuery: set a jQuery object as a [html] content
<p>Is there a shortcut for:  </p>

<pre><code>var child = $('&lt;span&gt;error message&lt;/span&gt;');
$('#parent').html(child.html());
</code></pre>

<p>or, the same</p>

<pre><code>var child = $('&lt;span&gt;error message&lt;/span&gt;');
$('#parent').empty().append(child);
</code></pre>

<p><strong>EDIT</strong>: above example won't work if I try to assign same child to multiple parents, my <code>child</code> object can only belong to a single parent (which is not what I wanted in my case).</p>

<p>I do realize I could do:</p>

<pre><code>$('#parent').html('&lt;span&gt;error message&lt;/span&gt;');
</code></pre>

<p>but I want to reuse <code>child</code> object.<br>
<strong>EDIT</strong>: again, this won't work, since <code>child</code> is a DOM object and can only be placed under at most one parent at any time.</p>

<p>I am looking for something like:  </p>

<pre><code>var child = $('&lt;span&gt;error message&lt;/span&gt;');
$('#parent').content(child);
</code></pre>
