views:

56

answers:

1

if i have a dropdown with the following html:

 <select id="myDropdown" name="myDropdown">
<option value="6">Six</option>
<option value="5">Five</option>
<option value="3">Three</option>
<option value="1">One</option>
</select>

how can i have this dropdown change to a specific selected value after i click on a button?

+2  A: 

If your button is id="myButton" you can do it like this:

$("#myButton").click(function() {
  $("#myDropdown").val(1); //1 being whatever value you want to set
});
Nick Craver