title: Create HTML tag from Javascript object
body: <p>What is the best method to change this object</p>
  
  <pre><code>{
      src: 'img.jpg',
      title: 'foo'
  }
  </code></pre>
  
  <p>into a valid <strong>HTML tag string</strong> like this</p>
  
  <pre><code>&lt;img src="img.jpg" title="foo" /&gt;
  </code></pre>
  
  <p><strong>Solution 1</strong></p>
  
  <p>With jQuery this is easy; but complicated:</p>
  
  <pre><code>$('&lt;img/&gt;').attr(obj).wrap('&lt;div/&gt;').parent().html();
  </code></pre>
  
  <p>Any better ideas?</p>