相关疑难解决方法(0)

如何清除选定的值selectize.js下拉列表

我有一个selectize.js下拉菜单,我必须清除所选的值.

我试过了 :

var selectize = $("#optionNetFlow")[0].selectize;
selectize.clear();
Run Code Online (Sandbox Code Playgroud)

如另一个问题中所建议的如何以编程方式设置selectize.js选项列表.但它给出了一个错误,

Uncaught TypeError: Cannot read property 'selectize' of undefinedmessage: "Cannot read property 'selectize' of undefined"stack: (...)get stack: function () { [native code] }arguments: nullcaller: nulllength: 0name: ""prototype: StackTraceGetterconstructor: function () { [native code] }__proto__: Object__proto__: function Empty() {}<function scope>set stack: function () { [native code] }__proto__: Error
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

当我把它改为:

    var selectize = $("#optionNetFlow").selectize;
    selectize.clear();
Run Code Online (Sandbox Code Playgroud)

我给出了错误:

TypeError: undefined is not a functionmessage: "undefined is not a function"stack: (...)get stack: function () { …
Run Code Online (Sandbox Code Playgroud)

javascript jquery selectize.js

34
推荐指数
4
解决办法
4万
查看次数

标签 统计

javascript ×1

jquery ×1

selectize.js ×1