简体   繁体   中英

selectize.js reset selected value

I am using selectize.js library in my angular project and I am trying to reset my form after submit. I want to reset all select dropdowns, but when I cleared the selectize fields all options are removed.

my code:

$('.select-beast').each(function(){
    var _thisEl = $(this);
    $(this).selectize({
        sortField: 'text',
        onChange:function(value){

        }
    });
});

to reset:

var selectize = $select[0].selectize;
selectize.clear()

any suggestions?

使用select[0].selectize.setValue(-1, false)进行重置。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM