title: Add innerHTML before an element in JavaScript?
body: <p>Now I am not talking about creating children or a child node, I literally mean HTML. This is what I want to do:</p>
  
  <p>I have a basic node, for example:</p>
  
  <pre><code>&lt;div id="foo"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>And I have a string of HTML, that I want to append before that element (kinda like what innerHTML does, with the difference, that I am obviously putting it before, not inside), e.g.:</p>
  
  <pre><code>"&lt;span&gt;hello, world&lt;/span&gt;&lt;div&gt;&lt;/div&gt;Foo&lt;img src="logo.png" /&gt;Bar"
  </code></pre>
  
  <p>Now I want to insert that HTML before the div, so my outcome would be:</p>
  
  <pre><code>&lt;span&gt;hello, world&lt;/span&gt;&lt;div&gt;&lt;/div&gt;Foo&lt;img src="logo.png" /&gt;Bar&lt;div id="foo"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Is there any way I can do this in JavaScript (without any library)? Thanks!</p>