title: How to replace element with text using JavaScript / jQuery?
body: <p>So assuming I had this:</p>
  
  <pre><code>&lt;span id="foo"&gt;bar&lt;/span&gt;
  </code></pre>
  
  <p>I want to replace it with this:</p>
  
  <pre><code>bar
  </code></pre>
  
  <p>In other words, I want to remove the span from the DOM, and insert its contents in its place.</p>
  
  <p>How can I achieve this, using code as minimal as possible? I want to use pure JavaScript, but jQuery's fine as well.</p>
  
  <p>Thanks.</p>