

Only applies when configured in multi-select mode. If set to false the dropdown is not closed after a selection is made, allowing for rapid selection of multiple items. When Select2 is attached to a select element this value will be ignored and select's

Whether or not Select2 allows selection of multiple values. Non-multi-value based selects because multi-value selects always provide such a button for every

This is the option that will be selected when the button is pressed since a select box requiresĪlso, note that this option only works with When attached to a select an option with an empty value must be provided. This option only works when the placeholder is specified. When clicked, resets the value of the select box back to the placeholder, thus this option isĪvailable when the placeholder is specified. Whether or not a clear button is displayed when the select box has a selection. The default delimiter is the, character. Separator character or string used to delimit ids in value attribute of the multi-valued selects. This option is useful when Select2's default of using the first option only if it has no value and no text is not suitable. When attached to a select resolves the option that should be used as the placeholder.Ĭan either be a function which given the select element should return the optionĮlement or a string first to indicate that the first option should be used. Is selected in non-multi-value select boxes an empty first option element must be provided ( ) Note that because browsers assume the first option element Or input element that Select2 is attached to. The placeholder can also be specified as a data-placeholder attribute on the select Initial value that is selected if no other selection is made. Once the number of selected items reaches the maximum specified the contents of the dropdown will be populated If this number is less than 1 selection is not limited. The maximum number of items that can be selected in a multi-select control. Only applies to single-value select boxes The option can be set to a negative value to permanently hide the search field. Is not very useful and wastes screen space. Is useful for cases where local data is used with just a few results, in which case the search box Populated in order to keep the search field. The minimum number of results that must be initially (after opening the dropdown for the first time) Maximum number of characters that can be entered for an input. Number of characters necessary to start a search. other values if the width attribute contains a function it will be evaluated, otherwise the value is used verbatim. resolve First attempts to copy than falls back on element. copy Copies the value of the width style attribute set on the source element. element Uses javascript to calculate the width of the source element. Keep in mind that the container div copies classes from the source element so setting the width attribute may not always be necessary. Controls the width style attribute of the Select2 container div.
