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
<div class="selDiv">
<select class="opts">
<option selected value="DEFAULT">Default</option>
<option value="SEL1">Selection 1</option>
<option value="SEL2">Selection 2</option>
</select>
</div>
By value, what worked for me with jQuery 1.7 was the below code, try this:
You can just use
val()
method:Using jquery-2.1.4, I found the following answer to work for me:
If you have a string value try the following:
Other examples did not work for me so that's why I'm adding this answer.
I found the original answer at: https://forum.jquery.com/topic/how-to-dynamically-select-option-in-dropdown-menu
For Jquery chosen if you send the attribute to function and need to update-select option
The
$('select').val('the_value');
looks the right solution and if you have data table rows then: