I am using the select2 control, loading data via ajax. This requires the use of the tag.
Now, I want to retrieve the selecte
The code below also solves otherwise
.on("change", function(e) {
var lastValue = e.currentTarget.value;
var lastText = e.currentTarget.textContent;
});
Also you can have the selected value using following code:
alert("Selected option value is: "+$('#SelectelementId').select2("val"));
This one is working fine using V 4.0.3
var vv = $('.mySelect2');
var label = $(vv).children("option[value='"+$(vv).select2("val")+"']").first().html();
console.log(label);