how to set selected option in select2 code example
Example: how to set value select2
$('#sel_users').select2().trigger('change');
$(document).ready(function(){
// Initialize Select2
$('#sel_users').select2();
// Set option selected onchange
$('#user_selected').change(function(){
var value = $(this).val();
// Set selected
$('#sel_users').val(value);
$('#sel_users').select2().trigger('change');
});
});