Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 = $("#optionNetFlow")[0].selectize; selectize.clear(); 

But it gives the following error:

enter image description here


When I change it to this:

var selectize = $("#optionNetFlow").selectize; selectize.clear(); 

I gives this error:

enter image description here


What I am doing wrong here?

like image 501
Pranav Singh Avatar asked Nov 14 '14 05:11

Pranav Singh


1 Answers

I finally found the answer here Selectize.js Demos

What works for me is:

 var $select = $('#optionNetFlow').selectize();  var control = $select[0].selectize;  control.clear(); 

what I was missing var $select = $('#optionNetFlow').selectize(); before applying the solution provided in above question's answer.

Now I am to get all the functions in console like :

enter image description here

like image 150
Pranav Singh Avatar answered Sep 20 '22 10:09

Pranav Singh