title: Basic markup taxonomy:
category: docs
process:
twig: 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.
Select2 will respond to the disabled
attribute on <select>
elements. You can also initialize Select2 with disabled: true
to get the same effect.
You can, and should, use a <label>
with Select2, just like any other <select>
element.
Click this to focus the single select element
Click this to focus the multiple 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>