title: Change image in button on click
body: <p>I've got a button with an image inside that I want to swap when clicked. I got that part working, but now I also want it to change back to the original image when clicked again.</p>
  
  <p>The code I'm using:</p>
  
  <pre><code>&lt;button onClick="action();"&gt;click me&lt;img src="images/image1.png" width="16px" id="ImageButton1"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>And the Javascript:</p>
  
  <pre><code>function action() {
    swapImage('images/image2.png');
  };
  
  var swapImage = function(src) {
    document.getElementById("ImageButton1").src = src;
  }
  </code></pre>
  
  <p>Thanks in advance!</p>