vendredi 5 avril 2019

Replace Selectize.js input value after initialization

I need to change values from one of my Selectize.js inputs. My input is in a Bootstrap modal.

I've tried solutions but every time it remove the value from my input without adding the new value.

I tried everything from this page: How to set a value for a selectize.js input?

like:

$('#myID').data('selectize').setValue([{value: "xxxxx yyyyyy"}]);

This is how I initialize my input:

$('#myID').selectize({
     create: true,
     persist: false,
     createOnBlur: true,
     copyClassesToDropdown: false,
     selectOnTab: false,
     onItemAdd: function(value) {
       xxxxx
     }
 });

This is my html input:

<div class="form-group col-md-6">

   <input type="text" id="myID" placeholder="XXXXX">

</div>

I want to be able to change my inputs value from another function




Aucun commentaire:

Enregistrer un commentaire