title: How to hide or show div on click?
body: <p>I'm trying to create a button which will show a div if it is hidden, or hide the div if it is already shown (doing it in javascript). I've written this code to be used onclick but it doesn't seem to work and I can't see why. Can someone see what I have done wrong?</p>
  
  <pre><code>if (document.getElementById('Hidey').style.display == 'none') {
  document.getElementById('Hidey').style.display = 'inline'
  }
  else {
  document.getElementById('Hidey').style.display = 'none'
  }
  </code></pre>
  
  <p>EDIT:
  HTML</p>
  
  <pre><code>&lt;div id="Button" onclick="javascript posted above here"&gt;&lt;h2&gt;Click&lt;/h2&gt;&lt;/div&gt;
  &lt;div id="Hidey"&gt;Content Inside&lt;/div&gt;
  </code></pre>
  
  <p>That's the HTML being effected, nothing else in my code effects these. I'm simply confused.</p>