I want to change placeholder of a dropdown created by selectize.js when the parent dropdown changes its selection to load the options of the dropdown whose placeholder to be changed. There is no method to do this in documentation.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
You can update the placeholder by setting selectize.settings.placeholder and then calling selectize.updatePlaceholder().
This is what worked for me (selectize version
"selectize": "^0.12.4"
and using typescript only):selectize.js will create an
input
below theselect
. Thisinput
will have the class.selectize-control
.You can replace the
placeholder
of thisinput
field with jQuery.You can do something like:
If you would like a working example, Ill need more information about your code.
You need two things:
<option></option>
as first option tag in the select.placeholder
key toselectize
callYou can specify placeholder for
select
elements by adding an emptyoption
element inside select tag. Here is an example: