title: Get Selected value from dropdown using JavaScript
body: <p>I have the following HTML</p>
  
  <pre><code>&lt;form&gt;
    &lt;div class="answer1wrap"&gt;
      &lt;select id="mySelect"&gt;
        &lt;option value="void"&gt;Choose your answer&lt;/option&gt;
        &lt;option value="To measure time"&gt;To measure time&lt;/option&gt;
        &lt;option value="To measure distance"&gt;To measure distance&lt;/option&gt;
        &lt;option value="To measure volume"&gt;To measure volume&lt;/option&gt;
      &lt;/select&gt;
    &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;button class="btn btn-default" id="checkbtn" onclick="answers();" type="button"&gt;&lt;span    class="glyphicon glyphicon-check"&gt;&lt;/span&gt; Check answers&lt;/button&gt;
  </code></pre>
  
  <p>I also have the javascript</p>
  
  <pre><code>function answers()
  {
    var selectedanswer=document.getElementById("mySelect").selectedIndex;
  
    if (document.getElementsByTagName("option")[selectedanswer].value=="To measure time");{
      alert("Thats correct"); 
    }
  }
  </code></pre>
  
  <p>I was hoping that when the button is pressed, it would check to see if the 'to measure time' option was selected and alert me ONLY if that was selected. However no matter which option has been selected it always shows the alert.</p>
  
  <p>Any ideas?</p>