title: jquery .html removing img closing tag?
body: <p>I'm using jquery to both set html with an img tag and later retrieve html with an img tag and store it in a datastore.</p>
  
  <p>When I initially set html, the string I'm passing in has a closing tag:</p>
  
  <pre><code>h += '&lt;div class="photo"&gt;'
  + '&lt;img src="' + msg + '" /&gt;'
  +  '&lt;/div&gt;';
  $('#thumb').html(h);
  </code></pre>
  
  <p>When I retrieve the html later, it does not have a closing tag.<br>
  This is causing issues when I try serve this html at a later date.</p>
  
  <pre><code>$('div.thumbnail').html() 
  </code></pre>
  
  <p>produces html like this without the closing tag:</p>
  
  <pre><code>&lt;div class="photo"&gt;
     &lt;img src="http://lh3.ggpht.com/blah.jpg"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><em><strong>EDIT</em></strong></p>
  
  <p>Thanks for all the suggestions.  In my case I kept getting an "<code>expected &lt;/img&gt;</code>" error when trying to serve the HTML back.</p>
  
  <p>So I changed my approach and used this code to retrieve the img src, rebuild the html, and then store it:</p>
  
  <pre><code>var xml = '&lt;?xml version="1.0" encoding="utf-8"?&gt;\n&lt;content&gt;\n';
  var img = $("#thumbimage").attr("src");
  
  xml += '&lt;thumbURL&gt;&lt;div class="photo"&gt;&lt;img src="' + img +  '"/&gt;&lt;/div&gt;'
      + '&lt;/thumbURL&gt;\n';
  </code></pre>