How to clear a selected value in Selectize.js dropdown?

后端 未结 6 1693
离开以前
离开以前 2021-02-05 00:39

I have a selectize.js dropdown and I have to clear the selected value .

I have tried this (as suggested in another question):

var selectize = $(\"#option         


        
6条回答
  •  既然无缘
    2021-02-05 01:06

    Or if you have multi select, and do want to restore selected items in the drop-down list (hide selected set to true).

    var selectize = $("#select-item").selectize;
    //clone array
    var items = selectize.items.slice(0);
    for (var i in items) {
        selectize.removeItem(items[i]);
    }
    selectize.refreshOptions();
    

提交回复
热议问题