I am trying to trigger a function when a value of a Select2 is selected. The select2 has name of colors.
$('#idColor').on('select2:selecting', function(e) {
console.log($('#idColor').val());
});
Example: I select the option Blue and nothing happened. Then I select the color Red and the console shows Blue.
The Select2 widget is in a Yii2 project created by another person. So I couldn't find its documentation web.
Maybe I have a similar problem to this, but this person use Backbone.js: Click and Change event not working for jquery-select2 options
I am learning jQuery, so maybe I am doing something wrong.