I am using selectize.js to provide some suggestions while the user enters a query in a textbox. However, I would like to prevent the dropdown from being opened if certain conditions are not met. I'm aware of the onDropdownOpen
callback, but it seems that the event can't be stopped from there. The following workaround doesn't work either.
onDropdownOpen: function($dropdown) {
// [Test some variables here]
$dropdown.collapse();
}
Is there anyway to achieve this?
This is what I tried that seems to be working https://plnkr.co/edit/DifihIuXoGkMxfdEht9L?p=preview