Sushant Bajracharya Sushant Bajracharya - 1 year ago 127
jQuery Question

How to get the value of crossed item from the multiple select in select2?

I am using the select2 plugin version 3.5.2. I am using the multiple select. Now suppose I selected a value from the dropdown list and then removed it again by clicking on the cross icon, how can I know its value ?

Answer Source

Select2 provides different events that you can use to catch selection, removal or other events. For your case you can use select2-removed event,

 $("#multipleSelectExample").on("select2-removed", function(e) {

Here is an working JSFiddle.

Also, I suggest you to use latest version of Select2 if possible as they have added tons of new features that you can work on with.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download