How to construct a jQuery object from HTML with leading \n \t \r and spaces
<p>I have a string with HTML from the website like:</p>

<pre><code>\n
&lt;div&gt;
\t&lt;div&gt;
...
\t&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>If I construct a jquery from this by:</p>

<pre><code>$(tmpl)   // like $("\n&lt;div&gt;")
</code></pre>

<p>It will give me error saying <code>"unrecognized expression:&lt;div&gt;    &lt;div&gt;    &lt;/div&gt;&lt;/div&gt;"</code>.</p>

<p>I tried using <code>$(tmpl.replace(/[\t\r\n]/,""))</code>. It works but does not seem natural to me.
I also tried using <code>$('body').append(tmpl)</code>; it does not require a <code>replace</code> but I want to change the attr/styles/data before I attach it to DOM. If I attach it first, I will need to select it again.</p>

<p>Is there any way to create a jquery object from this type of HTML snippets without <code>replace</code> and before attaching it to DOM?</p>
