Reputation: 615
I am looking for a way to execute a callback function when the element get focused in select2 Jquery. This was supported in older version. It was like this:
.on("select2-focus", function(e) { log ("focus");})
But in the last version they deleted based on this link version 4 is delete it and the reason was: select2-focus - Use the native focus event instead but how can I execute a callback when the event focus is fired ? I took a look at other questions related to this topic but there were no solution for this specific situation.
Upvotes: 0
Views: 559
Reputation: 526
You should try this:
$('select').on('select2:open', function(e) {
// do something
});
Everything described here: https://select2.github.io/options.html#events-public
Upvotes: 0