JQuery wrap() problem <p>Why doesn't the following code wrap the image with <code>&lt;li&gt;</code> tags and what would be the best way to do this?</p> <pre><code>var i = new Image i.src = '/images/image.jpeg' $(i).wrap('&lt;li /&gt;') $('div').html(i) </code></pre> <p>produces:</p> <pre><code>&lt;div&gt;&lt;img src="/images/image.jpeg"&gt;&lt;/div&gt; </code></pre> <p>instead desired:</p> <pre><code>&lt;div&gt;&lt;li&gt;&lt;img src="/images/image.jpeg"&gt;&lt;/li&gt;&lt;/div&gt; </code></pre>