Получите выбранное значение SELECT2
//initialize
$('#mySelect2').select2('data');
//get selected value
$('#mySelect2').find(':selected');
Andrew Lautenbach
//initialize
$('#mySelect2').select2('data');
//get selected value
$('#mySelect2').find(':selected');
<select id="lang" >
<option value="1">php</option>
<option value="2">asp</option>
<option value="3">java</option>
</select>
<script>
$("#lang").select2().select2('val','1');
</script>
$('#id :selected').text();
$('#mySelect2').val('1'); // Select the option with a value of '1'
$('#mySelect2').trigger('change'); // Notify any JS components that the value changed
$('#mySelect2').val(['1', '2']);
$('#mySelect2').trigger('change'); // Notify any JS components that the value changed