Accessing Select2 Close event

Accessing Select2 Close event

_Ronnie__Ronnie_ Posts: 19Questions: 5Answers: 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());
}

etc

Many thanks for your input.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    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.

    Cheers,

    Colin

This discussion has been closed.