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

后端 未结 6 1691
离开以前
离开以前 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 00:57

    Try this out:- http://jsfiddle.net/adiioo7/2gnq1ruv/204/

    JS:-

    jQuery(function ($) {
        var $select = $('#input-tags').selectize({
            persist: false,
            create: true
        });
    
        $("#btnClear").on("click", function () {
            var selectize = $select[0].selectize;
            selectize.clear();
    
        });
    });
    

提交回复
热议问题