Reputation: 10376
I found this jfiddle from another Stack post. It works fine except I'm looking to set the default value on the dropdown on load.
Instead of showing "-- Select --" for all 3 dropdown, I'm looking to load the values from a DB, hence it will display an existing value.
Of course this won't work.
<select id="select1"><option value="2">Question2</option></select><br />
<select id="select2"></select><br />
<select id="select3"></select></br>
http://jsfiddle.net/sushanth009/a3yrQ/
Upvotes: 2
Views: 307
Reputation: 55750
Just use .val()
and trigger the change event.
$('#select1').val(your value).change()
$('#select1').val(1).change();
$('#select2').val(3).change();
$('#select3').val(4).change();
Upvotes: 2