title: Show and hide image js
body: <p>I want to toggle the visibility on and off. So the second click on the button should hide the image again. How do I do this?</p>
  
  <p>This is my current code which only toggles the hidden .png on.</p>
  
  <pre><code>&lt;div&gt;
  &lt;script type="text/javascript"&gt;
      function showImage(){
          document.getElementById('loadingImage').style.visibility='visible';
      }
  &lt;/script&gt;
  
  &lt;input id="text" type="button" value="Explosion Button" onclick="showImage();"/&gt;
  &lt;img id="loadingImage" src="explosions.png" style="visibility:hidden"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>Thanks!</p>