Select2 use duplicate tags


#1

Hello!

I would like to use the same tag multiple times to fit my data. Based on this answer here : https://github.com/select2/select2/issues/3341 I found this : https://stackoverflow.com/questions/14976099/select2-multiselect-duplicates-values

In select2 - 4.0.5 this is kind of working but I still go an error when unselecting :

Uncaught TypeError: Cannot read property 'remove' of undefined

What can I do to allow multiple select tags?

Thanks you


#2

The code in the JSFiddle linked to the first answer to the StackOverflow post seems to work (I tried it, here: https://jsfiddle.net/nsdont/pu6yhbxy/4/) . However, it uses an old version of Select2, and my guess is that later versions do not support the approach that was used in the answer.

Do you get the error every time you unselect a tag, or only when you unselect a duplicate?

Can you post a sample of your code on JSFiddle.net or Codepen.io?