How come this JQuery code returns nothing?
<pre><code>&lt;script src="http://code.jquery.com/jquery-1.7.1.min.js"&gt;&lt;/script&gt;
&lt;script&gt;
var newvalue = '&lt;img class="youtube_replace youtube_canvas" data-code="Wn-_MyJV37E" src="http://img.youtube.com/vi/Wn-_MyJV37E/0.jpg" /&gt;';

var abc = $('&lt;div&gt;' + newvalue + '&lt;/div&gt;').find('*').each(function() {
}).html();

alert(abc);

&lt;/script&gt;
</code></pre>

<p>I want abc to equal "newvalue".  But in my current code, abc is empty. Why?</p>

<p>This is what I truly want to do, but for example purposes, I left this blank above:</p>

<pre><code>var whitelist = ['a','div','img', 'span'];
var abc = $('&lt;div&gt;' + newvalue + '&lt;/div&gt;').find('*').each(function() {
    if($.inArray(this.nodeName.toLowerCase(), whitelist)==-1) {
        $(this).remove();
     }
}).html(); //abc is now sanitized!!!
</code></pre>
