title: On select change redirect to url jQuery
body: <p>I am trying to redirect to url when a select is changed and add option text in url query parameter, I have tried this but it seems not working:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function () {
              var url = window.location.href;
              $("#select-opt").change(function() {
                  var option = $(this).find('option:selected');
                  url = option.data("url");
              });
          });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;select id="select-opt" onchange="this.options[this.selectedIndex].value &amp;&amp; (window.location = this.options[this.selectedIndex].value);"&gt;
          &lt;option value="test-select1.html"&gt;Value 1&lt;/option&gt;
          &lt;option value="test-select2.html"&gt;Value 2&lt;/option&gt;
          &lt;option value="test-select3.html"&gt;Value 3&lt;/option&gt;
      &lt;/select&gt;</code></pre>
  </div>
  </div>
  </p>