javascript - jQuery - load url value -



javascript - jQuery - load url value -

i'm looking @ implementing country selector http://baymard.com/labs/country-selector

one alter i'm stuggling create is: instead of showing alert pop-up 1 time submitted, i'd when forms value="[url]" load page when submitted.

currently script:

<script> (function($){ $(function(){ $('select').selecttoautocomplete(); $('form').submit(function(){ alert( $(this).serialize() ); homecoming false; }); }); })(jquery); </script>

i've tried number of different solutions end losing typing fuctionality , reverting standard drop downwards links working. ideas on how both working?

here's snippet of html:

<form> <select style="padding:10px; width:200px;" name="country" id="country-selector" autofocus autocorrect="off" autocomplete="off"> <option value="http://manchester.china-consulate.org/eng/" data-relevancy-booster="3.5" data-alternative-spellings="cn zhongguo zhonghua peoples republic 中国/中华">china</option> </select> <input style="padding:10px;" type="submit" value="submit">

you need add together location.href redirect page. since didn't add together html of code, i've added javascript input field value name "value";

<script> (function($){ $(function(){ $('select').selecttoautocomplete(); $('form').submit(function(){ var url = document.getelementsbyname("value")[0].value; window.location.href = url; homecoming false; }); }); })(jquery); </script>

javascript jquery forms url submit

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -