title: How to get the value of a select drop down in javascript?
body: <p>How can I alert the value selected by user from a select drop down box in Javascript. In this example I want to store the value inside a variable and alert it to the user.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  function processmyform() {
  
      var chosenAnimal = // what goes here
  
      alert(chosenAnimal);
  
  }
  &lt;/script&gt;
  
  &lt;form action=""&gt;
      &lt;select name="animal" class="favAnimal"&gt;
          &lt;option value="dog"&gt;Dog&lt;/option&gt;
          &lt;option value="cat"&gt;Cat&lt;/option&gt;
          &lt;option value="bird"&gt;Bird&lt;/option&gt;
      &lt;/select&gt;
      &lt;a href="#" onclick="processmyform()" /&gt;
  &lt;/form&gt;
  </code></pre>