Multiple select2 and duplicated items

The select2 plugin is great and works quite well for non-repeated items. However if you want to allow the user to select the same item multiple times then you might get into trouble (as I did).

select2 was not built with this idea of duplicated items in mind but since I needed it I had to hack this concept into it :)

Allow items to be repeated (select tag)

    

 

Default behavior i.e. no repetition (select tag)

  

 

Allow items to be repeated with preselection (hidden input)