title: Javascript to open specific URL on dropdown select
body: <p>I have this specific requirement to open different URL on new tab/page based on selection of Dropdown HTML menu. The action of opening the page should happen on selection of option from list instead of having any button.
  Basically the url should open with the option selected at the end so user can land to specific page.
  Please find my code below and suggest the solution. Thanks in Advance.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          function run(){
              var v1 = document.getElementById("val").value;
              var v2 = document.getElementById('input1').value;
  
              function () {
              if (v1=="1") {window.open("URL" + v1 + "/" + v2, '_blank')}
              else if  (v1=="2") {window.open("URL" + v1 + "/" + v2, '_blank')}
              else {alert("");}
              return false
              };
          }
  &lt;/script&gt;
  
  &lt;input type="text" id="input1" style="width: 100px;" /&gt;
  &lt;select id="val" onchange="run()"&gt;
      &lt;option value="" selected="selected"&gt;Select&lt;/option&gt;
      &lt;option value="1"&gt;Option 1&lt;/option&gt;
      &lt;option value="2"&gt;Option 2&lt;/option&gt;
      &lt;option value="3"&gt;Option 3&lt;/option&gt;
      &lt;option value="4"&gt;Option 4&lt;/option&gt;
      &lt;option value="5"&gt;Option 5&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>