title: How to use html option tag and check which option is selected?
body: <p>I am trying to add a scroller feature to my website. The  tag works well for this and I want to load a new website if an option is selected. Heres what I currently have.</p>
  
  <pre><code>&lt;body&gt;
  &lt;script type="text/javascript"&gt;
      $('document').ready(function(){
                          $('#button').click(function(){
                                  var val = document.getElementById("scroll");
                                                         if(val.options[val.selectedIndex].value == 1){
                                                         window.location.replace("/passbook.html");
                                                         }else if(val.options[val.selectedIndex].value == 2){
                                                         window.location.replace("/settings.html");
                                                         }
                                                         });
                                             });
                          });
      &lt;/script&gt;
  
  &lt;select id="scroll" style="height:50px; width:150px;" &gt;
  &lt;optgroup label="Home"&gt;
  &lt;option value="0" &gt;Home&lt;/option&gt;
  &lt;/optgroup&gt;
  &lt;optgroup label="Page" &gt;
  &lt;option value="1" &gt;Page&lt;/option&gt;
  &lt;/optgroup&gt;
  &lt;optgroup label="Other" &gt;
  &lt;option value="2" &gt;Settings&lt;/option&gt;
  &lt;/optgroup&gt;
  &lt;/select&gt;
  &lt;button type="button"&gt;Go&lt;/button&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Right now nothing visibly happens when go is clicked. I would like a redirect to those pages. I know that window.location.replace(Your URL Here) works. Can someone help me with the javascript?</p>