title: Show and hide div elements based on dropdown selection in html using javascript
body: <p>I have a question using javascript to show hide a div when using a dropdown. Code works for links and buttons but im asking if there's any way to rewrite it so it can use the SELECT option. Like if i select 'Show' from dropdown it will show me the div containing 'Hello world!'</p>
  
  <p>My current Javascript:</p>
  
  <pre><code>&lt;script&gt;
  function showMe(id) {
      var e = document.getElementById(id);
      if(e.style.display == "block") {
          e.style.display = "none";
      } else {
          e.style.display = "block";
      }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>And the index.html contains:</p>
  
  <pre><code>&lt;select&gt;
      &lt;option&gt;Hide&lt;/option&gt;
      &lt;option onselect="showMe('idShowMe')"&gt;Show&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;div id="idShowMe" style="display: none"&gt;
      &lt;b&gt;Hello world!&lt;/b&gt;
  &lt;/div&gt;
  </code></pre>