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
you just use select field id instead of #id (ie.#select_name)
instead of option value use your select option value
<script>
$(document).ready(function() {
$("#id option[value='option value']").attr('selected',true);
});
</script>
$(elem).find('option[value="' + value + '"]').attr("selected", "selected");
You could name the select and use this:
$("select[name='theNameYouChose']").find("option[value='theValueYouWantSelected']").attr("selected",true);
It should select the option you want.
The $('select').val('the_value');
looks the right solution and if you have data table rows then:
$row.find('#component').val('All');
For Jquery chosen if you send the attribute to function and need to update-select option
$('#yourElement option[value="'+yourValue+'"]').attr('selected', 'selected');
$('#editLocationCity').chosen().change();
$('#editLocationCity').trigger('liszt:updated');
i'll go with:-
$("select#my-select option") .each(function() { this.selected = (this.text == myVal); });