How to change placeholder of selectize.js dropdown?

后端 未结 10 1391
盖世英雄少女心
盖世英雄少女心 2021-02-14 12:30

I want to change placeholder of a dropdown created by selectize.js when the parent dropdown changes its selection to load the options of the dropdown whose placeholder to be cha

10条回答
  •  滥情空心
    2021-02-14 13:28

    This is what worked for me (selectize version "selectize": "^0.12.4" and using typescript only):

    this.selectize = $(this.select).selectize({
      options: this.options,
      placeholder: 'My Placeholder'
    })[0].selectize;
    
    this.selectize.settings.placeholder = 'Another Placeholder';
    this.selectize.updatePlaceholder();
    

提交回复
热议问题