To change the selected value, or selected index if you will, of a dropdown list using jQuery is not particularly difficult.
The classic method to achieve this is to simply set the dropdown’s value to a value already contained in the list using val(). (Of course this does require that the specified value is actually in the list, either specified as the value of an option or the option text itself!)
Given:
<select name=”testselect” id=”testselect”>
<option>Value 1</option>
<option>Value 2</option>
</select></div>
We can force the selection of the second option with:
$('#testselect').val('Value 2');
Alternatively, now that the jQuery bug has been fixed, you could also set the selectedIndex attribute of the dropdown list like so:
$("#testselect").attr('selectedIndex', 1);
And now you know! :)