Sometimes a placeholder needs to be visible before an actual selection is made.

The placeholder can be declared using a placeholder property when configuring the Select2. This can also be declared through the data-placeholder attribute when attached to a select tag.

The placeholder can be reset after a selection is made by setting the allowClear flag when initializing Select2.

Watch out! In order to use a placeholder with a single-value select box, you must include a blank <option></option> tag as the first option.
HTML



JavaScript

            

Select2 also supports multi-value select boxes:

As long as the select box has the multiple attribute set, Select2 will automatically pick this up.

Placeholders will be reset on multi value select boxes by default when no options are selected.
HTML

JavaScript