title: Replacing multiple images with their src attribute using JavaScript
body: <p>I have a variable <code>myvar = document.getElementById('myid').innerHTML</code> that I would like to replace all of the images in with their corresponding src attribute using JavaScript.</p>
  
  <p><strong>EDIT:</strong> Sorry for the confusion! I was trying to be succinct, time being precious and all - apparently I failed.</p>
  
  <p>To borrow from Jon's interpretation:</p>
  
  <p>I want to store all elements with the id of <code>myid</code> in <code>myvar</code> and then iterate through them to change all of them to plain text - the plain text being the value of their <code>src</code> attributes.</p>
  
  <p>Here is an example of what I would like to achieve.</p>
  
  <p>I start with something like this:</p>
  
  <pre><code>&lt;img src="someimage.png"&gt;&lt;br&gt;
  Lorem ipsum dolor sit amet&lt;br&gt;
  &lt;img src="anotherimage.jpg"&gt;&lt;br&gt;
  Lorem ipsum dolor sit amet
  </code></pre>
  
  <p>And it would translate to:</p>
  
  <pre><code>someimage.png&lt;br&gt;
  Lorem ipsum dolor sit amet&lt;br&gt;
  anotherimage.jpg&lt;br&gt;
  Lorem ipsum dolor sit amet
  </code></pre>