3.3 KiB
3.3 KiB
title | taxonomy | process | never_cache_twig | ||||
---|---|---|---|---|---|---|---|
Basic markup |
|
|
true |
A standard <select>
box contains any number of <option>
elements. Each of these is rendered as an option in the dropdown menu. Select2 preserves this behavior when initialized on a <select>
element that contains <option>
elements.
Disabling a Select2 control
Select2 will respond to the disabled
attribute on <select>
elements. You can also initialize Select2 with disabled: true
to get the same effect.
Enable
Disable
Labels
You can, and should, use a <label>
with Select2, just like any other <select>
element.
<label for="id_label_single">
Click this to highlight the single select element
<select class="js-example-basic-single js-states form-control" id="id_label_single"></select>
</label>
<label for="id_label_multiple">
Click this to highlight the multiple select element
<select class="js-example-basic-multiple js-states form-control" id="id_label_multiple" multiple="multiple"></select>
</label>