title: Hide div after showing it with javascript
body: <p>I'm using javascript to show a hidden div by clicking a button. After the div is displayed, I want to be able to click the button again and hide the div, and so on...</p>
  
  <p>Here is my javascript:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function showDiv() {
     document.getElementById('dropdownText').style.display = "block";
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>This is the button:</p>
  
  <pre><code>&lt;input type="button" name="answer" value="+" onclick="showDiv()" /&gt;
  </code></pre>
  
  <p>This is the hidden div:</p>
  
  <pre><code>&lt;div id="dropdownText" style="display:none;"&gt;
     This is the dropdown text.
  &lt;/div&gt;
  </code></pre>