title: Pass selected value from <select> HTML markup to JAVASCRIPT
body: <p>How can i get the value of the <code>&lt;select&gt;</code> markup in my html and pass it on my javascript.</p>
  
  <p>when i select <code>red</code> it should display my <code>&lt;div id="red"&gt;</code> 
  im new to JS, so im not sure if i got the correct syntax.</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;select&gt;
  &lt;option name="choice1" value="red" onclick="color(this.value)"&gt;red&lt;/option&gt;
  &lt;option name="choice2" value="blue" onclick="color(this.value)"&gt;blue&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;div id="red" style="display:none;"&gt;
  &lt;p&gt;You want RED&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;div id="blue" style="display:none;"&gt;
  &lt;p&gt;You want BLUE&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JAVASCRIPT</p>
  
  <pre><code>function color(color_type){
  if (color_type == 'blue'){
  document.getElementById('blue').style.display = 'block';
  document.getElementById('red').style.display = 'none';
  } 
  else{
  document.getElementById('blue').style.display = 'none';
  document.getElementById('red').style.display = 'block';
  }
  }
  </code></pre>