I\'m using Oleg\'s select2 demo, but I am wondering whether it would be possible to change the currently selected value in the dropdown menu.
For example, if the fou
if you want to set a selected item when you know the text from drop down list and don't know the value, here is an example:
Say you figured out a timezone and want to set it, but values has time_zone_id in them.
var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
var $select2 = $('#time-zone');
var selected = $select2.find("option:contains('"+timeZone+"')").val();
$select2.val(selected).trigger('change.select2');