get selected value jquery select2 code example
Example 1: get select2 selected value
//initialize
$('#mySelect2').select2('data');
//get selected value
$('#mySelect2').find(':selected');
Example 2: jquery select2 set value
<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>