I am looking everywhere and I can not find how I can fill an input of a multiple select using select2.
the code I'm using is this:
if (ui.item.tallas >= 1) { $('#'+Talla).val(ui.item.talla.split(',')).trigger('change'); $('#'+Talla).select2("val", ui.item.talla.split(',')); } //compruebo que hay tallas
I call it 2 times to test if one of the two forms does it, but nothing neither one nor the other.
The selection I use is this:
<select tabindex="14" name="InPedido_Talla[]" id="InPedido_Talla" style="width: 80px;" class="multibuskiselect multibuskiselect_InPedido" multiple="multiple">
and the data received comes from mysql separated by a comma. that's why the split.
How could I insert those values into the input?