Select2 : get selected value/text
Use data to retrieve the ID and Text of the selected option.
HTML
<script src="http://ivaynberg.github.com/select2/select2-master/select2.js"></script>
<link rel="stylesheet" href="http://ivaynberg.github.com/select2/select2-master/select2.css">
<button id="btn1">Null</button>
<select id="test">
<option value="AL">Alabama</option>
<option value="A2">2</option>
<option value="A3">3</option>
<option value="A4">4</option>
</select>
<p id="results">test</p>
JavaScript
var count = 0;
var $docInput = $('#test');
$($docInput).select2();
$('#btn1').click(function(){
$($docInput).select2('data', null, false);
});
$('#test').change(function(e){
alert(count);
count++;
$('#results').html('Change Count: ' + count);
});