I am using Select2 drop down and I need to do some functionalities based on the the drop down selection.
I have tried the following code, but it didn't worked for me.
$eventSelect.on("select2:select", function (e) { log("select2:select", e); });
$eventSelect.on("change", function (e) { log("change"); });
Can anyone tell me how can I make this work?
I am using select2 version 3.3.2 and the following code is working for me
$("#id").on("change", function () { debugger; });
You can try declaring the event after you know the web page has fully loaded, in my case, this was the problem:
$(document).ready(function(){
$('#yourselect').on("select2:select", function(e) {
console.log($(this).val());
});
});
$(document).on('change', '.js-example-basic-single', function(e) {
console.log($(this).val());})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With