How to enable multiple selection of the same item in multi-select boxes?

I am using Select2 version 4.0.5. I want to be able to select the items in the options list more than once.
I mean that by default Select2 allows me to select A, B, C but not A, A, B, B, B, C, C in the value field.
How can I achieve this?


You can’t. I assume you’re using a multiple select element, which allows you to select multiple items in the select. The Select2 widget is just a fancy user interface on top of the select element; it can’t fundamentally allow you to do anything you couldn’t do with a plain HTML select. Since you can’t select a single element more than once in a plain HTML select, you can’t do it with Select2 either.

If you want to allow your user to select items from a Select2 widget more than once, I recommend using a single-select element. When the user makes a selection, add your own “tag” containing the selection to another element on your page (say, a div), and then clear the current selection from the HTML select (and trigger it’s change event so the Select2 will pick up the change and update its display).

Is this still the case?

I have heard that it got included in version 4.0 and it would be really useful if it was.

Version 4 is the latest stable version (although version 5 is in development). As far as I know, Version 4 doesn’t support what you’re describing, and it doesn’t seem like it’s being considered for version 5 either.

As I mentioned before, what you’re describing is not a feature of a plain HTML select element, so it’s not likely that Select2 would support that feature either.

6 years after i am here …

Any news about this feature ?
Could be great to have something like that