If you know the Index, Value or Text. also if you don\'t have an ID for a direct reference.
This, this and this are all helpful answers.
Example markup
For setting select value with triggering selected:
$('select.opts').val('SEL1').change();
For setting option from a scope:
$('.selDiv option[value="SEL1"]')
.attr('selected', 'selected')
.change();
This code use selector to find out the select object with condition, then change the selected attribute by attr()
.
Futher, I recommend to add change()
event after setting attribute to selected
, by doing this the code will close to changing select by user.