title: Go to URL after selecting an option in optgroup
body: <p>I want to learn how to use JavaScript (or the jQuery library) in order to go to a url indicated as a value of the option tag inside an optgroup tag. </p>
  
  <p>With a simple, one-level select tag containing option tags, the solution can be similar to that described <a href="http://www.cs.tut.fi/~jkorpela/forms/navmenu.html" rel="nofollow">in this post</a>:</p>
  
  <pre><code>&lt;FORM NAME="nav"&gt;&lt;DIV&gt;
  &lt;SELECT NAME="SelectURL" onChange=
  "document.location.href=
  document.nav.SelectURL.options[document.nav.SelectURL.selectedIndex].value"&gt;
  &lt;OPTION VALUE="http://www.cs.tut.fi/~jkorpela/forms/jsnav.html"
  SELECTED&gt;Please select an item:
  &lt;OPTION VALUE="http://www.cs.tut.fi/~jkorpela/forms/"&gt;
  Main page on HTML forms
  &lt;OPTION VALUE="http://www.cs.tut.fi/~jkorpela/forms/choices.html"&gt;
  Choices in HTML forms
  &lt;OPTION VALUE="http://www.cs.tut.fi/~jkorpela/forms/tables.html"&gt;
  Tables and forms
  &lt;OPTION VALUE="http://www.cs.tut.fi/~jkorpela/forms/methods.html"&gt;
  Form submission methods (GET and POST)
  &lt;/SELECT&gt;&lt;DIV&gt;
  &lt;/FORM&gt;
  </code></pre>
  
  <p>I tried to use it with a two-level select tag with option tags inside optgroup tags – and it's not working for me. I'd appreciate help with adapting this code.</p>