Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

jQuery - passing selected parameter value as URL

0 votes
45 views
added Mar 19 in jQuery by LC Marshal Lieutenant (18,350 points)
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
var lcDomain = "https://lazacode.org/";
var value = "";
$(document).ready(function(){
    $("select").change(function(){
        // alert($(this).val());
        value = $(this).val();
        window.location.href = lcDomain+'&state='+value;
    });
});
</script>
</head>
<body>


Select State:
<select name="state"> 
  <option value ="">Choose</option>
  <option value="Kuala%20Lumpur">Kuala Lumpur</option> 
  <option value="Selangor">Selangor</option> 
</select>


</body>
</html>

 

Please log in or register to response this reference.

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...