Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

location on select dropdown redirect jquery

<select id="dynamic_select">
  <option value="" selected>Pick a Website</option>
  <option value="http://www.google.com">Google</option>
  <option value="http://www.youtube.com">YouTube</option>
  <option value="https://www.gurustop.net">GuruStop.NET</option>
</select>

<script>
    $(function(){
      // bind change event to select
      $('#dynamic_select').on('change', function () {
          var url = $(this).val(); // get selected value
          if (url) { // require a URL
              window.location = url; // redirect
          }
          return false;
      });
    });
</script>
Comment

PREVIOUS NEXT
Code Example
Javascript :: remove last two elements array javascript 
Javascript :: once content is loaded run function 
Javascript :: get actual url in variable 
Javascript :: adonis js sort by 
Javascript :: electron quit app from renderer 
Javascript :: stop settimeout 
Javascript :: jest setImmediate is not defined 
Javascript :: nest js doesnt recognize changes 
Javascript :: hello world expressjs 
Javascript :: fibonacci js code 
Javascript :: object to query string javascript 
Javascript :: jquery cast to string 
Javascript :: how to open html file with javascript 
Javascript :: remove react native cli mac 
Javascript :: columndefs in datatable not working while setting width jquery 
Javascript :: tabe close alert in js 
Javascript :: import formik 
Javascript :: convert milit second to date javascript 
Javascript :: select option in reactive forms 
Javascript :: refresh page after success ajax 
Javascript :: initialize json array 
Javascript :: jquery datepicker change date format 
Javascript :: jquery submit refresh page stop 
Javascript :: apache angular routing 
Javascript :: discord.js message on member add 
Javascript :: Material App debug mode 
Javascript :: queryselector with ul and not selecting particular li with id 
Javascript :: write json file in node js 
Javascript :: javascript compare two arrays of objects get same elements 
Javascript :: autoplay video in angular 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =