Search code examples
javascriptjquery-select2-4jquery-select2

Select2 on change removed id value


On select2 version 3 in event I get e.removed.id as value of previous select2 value but not in version 4.

So this way I am not able to get the previous select2 value which was changed. I can save it in variable but getting from event was easier.

Can anyone confirm.


Solution

  • The property removed was replaced by select2:unselect event in fourth version of select2 you could notice that in version 4.0.0-BETA.2 BREAKING CHANGES.

    • All extra properties of change have been removed :

      • val - Use $element.val() instead
      • removed - Use the select2:unselect event instead
      • added - Use the select2-selected event instead

    Hope this helps.