How to change placeholder of selectize.js dropdown?

后端 未结 10 1389
盖世英雄少女心
盖世英雄少女心 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:24

    You can update the placeholder by setting selectize.settings.placeholder and then calling selectize.updatePlaceholder().

    $(document).ready(function() {
      var s = $('#input-tags').selectize({
        persist: false,
        createOnBlur: true,
        create: true,
        placeholder: 'start placeholder'
      })[0].selectize;
    
      $('#updatePlaceholder').click(function() {
        s.settings.placeholder = 'new placeholder';
        s.updatePlaceholder();
      });
    });
    
    
    
      
        
        
        
        
        
        
      
    
      
        

    Selectize setting placeholder

提交回复
热议问题