Accessing Select2 Close event

Accessing Select2 Close event

_Ronnie__Ronnie_ Posts: 7Questions: 2Answers: 0

I wonder if you can help out with my JS issue.

I am using select2 box in Editor. I want to capture the value of the clicked item and execute some JS before the user clicks on the submit button. Do you know how I can capture this event:

For example, I would like to do this:

.on('select2:close', function() {
var itemclicked= $(this);
alert (itemclicked.val());


Many thanks for your input.

This question has an accepted answers - jump to answer


  • colincolin Posts: 6,890Questions: 0Answers: 1,177
    Answer ✓

    Ronnie ,

    You should be able to use dependent() - the change of value will give you an opportunity to run your code there. See example here.



Sign In or Register to comment.