title: return image as HTML
body: <p>trying to add an image to my innerHTML. </p>
  
  <p>Looked at a few prvious Q's
  <a href="https://stackoverflow.com/questions/9524458/why-does-my-image-not-show-up-when-i-use-javascript-innerhtml-to-call-it">Why does my image not show up when I use Javascript innerHTML to call it?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/11266104/javascripts-innerhtml-not-working-for-images-but-works-with-text">Javascripts innerHTML not working for images, but works with text?</a></p>
  
  <p>I cant get it working, in google dev tools throws the error:</p>
  
  <pre><code>Uncaught TypeError: Cannot set property 'innerHTML' of null
  </code></pre>
  
  <p>with this line:</p>
  
  <pre><code>var newImage = document.getElementById('img').innerHTML = "&lt;img src='images/bg-main.png&gt;&lt;/img&gt;";
  </code></pre>
  
  <p>my code looks like:</p>
  
  <pre><code>   function showImage() {
      var img = document.createElement('image');
      //var newImage = document.getElementById('img').innerHTML = "&lt;a href='#'&gt;&lt;img src='http://mintywhite.com/wp-content/uploads/2012/10/fond-ecran-wallpaper-image-arriere-plan-hd-29-HD.jpg' border=0/&gt;&lt;/a&gt;";
      var newImage = document.getElementById('img').innerHTML = "&lt;img src='images/bg-main.png&gt;&lt;/img&gt;";
      var div5 = document.createElement('div');
      div5.appendChild(newImage);
  
      return div5.innerHTML;
  
  }
  </code></pre>
  
  <p>I know there are many other methods to display an image, but for the purpose of this exercise I want to return the image as an innerHTML</p>