I’ve tried the following but they return the list of select values not the option that fired the onchange event. How can I identify the selected option’s value that fired the event?
$('#ddlCostCenters').on('change', function (e) {
alert($(this).val()); //returns the list of selected
alert(e.currentTarget.value); //returns the list of selected
});
2
Answers
The function signature is the key. Parm names element and checked provide what is needed.
The following is a great source for learning how bootstrap works Bootstrap multi-select
Below is a work demo to get the value of the currently selected option , you can refer to it.
Brand:
VehicleVM:
Controller:
Index view:
result: