Move tag from one select2 to another


#1

Hi, Its possible by drag and drop move tag from one select2 to another? Thanks


#2

That capability is not supported by Select2. If you have some advanced programming skills you could probably hack a solution yourself. Basically, you would have to add code to make the tags draggable, and to make the “receiving” Select2 a drop target (it’s not clear from your question whether just one particular Select2 can receive the tag(s) from one or more other Select2s, or whether tags could be dragged and dropped among multiple Select2s.) Anyway, the idea would be that once the tag is dropped on the receiving Select2 (i.e, in your “onDrop” handler), you would programmatically unselect the selected item (represented by the tag)—and perhaps its <option>—from the “source” Select2, and programmatically add and select the <option> to the “target” Select2. Select2 supports the programmatic features I’ve described. You would just have to wire it all up.