How to set a value for a selectize.js input?

后端 未结 11 2102
没有蜡笔的小新
没有蜡笔的小新 2020-12-13 23:51

I have a form from which I would like to copy some default values into the inputs. The form inputs are using the selectize.js plugin. I would like to set some of the form

11条回答
  •  情歌与酒
    2020-12-14 00:13

    just ran into the same problem and solved it with the following line of code:

    selectize.addOption({text: "My Default Value", value: "My Default Value"});
    selectize.setValue("My Default Value"); 
    

提交回复
热议问题