简体   繁体   中英

How to disable selectize.js?

I am trying to disable my selectize dropdown. Initially, upon loading of the page the dropdown should be disabled. I tried adding disabled to the select but I still can choose an item. How can I disable the selectize dropdown?

Here is what I have tried so far:

document.getElementById("gender").disabled = true;

UPDATE I tried using the .disabled() but still not disabling

$('#gender').selectize().disable();

Using disable() mehtod.

disable() Disables user input on the control completely. While disabled, it cannot receive focus.

selectize.js/api.md at master · selectize/selectize.js

确保您只禁用选择和其中的选项

Check ID again , are you sure you are using right Id. var x = document.getElementById("gender").disabled; through this check out if a drop-down list is disabled or not.

Try $("#gender").disabled = true;

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