title: Insert image object into HTML
body: <p>I'm just curious to know if there's a better solution for doing this:</p>
  
  <pre><code>var img = new Image();
  var div = document.getElementById('foo');
  
  img.onload = function() {
    div.innerHTML += '&lt;img src="'+img.src+'" /&gt;'; 
  };
  
  img.src = 'path/to/image.jpg';
  </code></pre>
  
  <p>Desired method:</p>
  
  <pre><code>console.log(img); // &lt;img src="path/to/image.jpg" /&gt;
  div.innerHTML += img;
  </code></pre>
  
  <p>Thoughts?</p>