+ Some option names may have changed during the last few commits!
+
-
- First, the jQuery library needs to be included. Then Twitter Bootstrap - both the Javascript library and the CSS stylesheet - needs to be included.
-
+
+ Please consult the FAQ and the Issue Tracker before
+ creating a new issue.
+
+ First, the jQuery library needs to be included.
+ Then Twitter Bootstrap - both the
+ Javascript library and the CSS stylesheet - needs to be included.
+
<!-- Include Twitter Bootstrap and jQuery: -->
@@ -82,24 +89,31 @@
- Note that the plugin will work both with version 2.x of the jQuery library as well as with version 1.10.x of the jQuery library. So for using the Google CDN you may have to adjust the version.
-
-
-
-
Create a Select
+
+ Note that the plugin will work both with version 2.x of the jQuery library as well as with
+ version 1.10.x of the jQuery library. So for using the Google CDN you may have to adjust the
+ version.
+
+
+
+
Create a Select
-
- Now simply use HTML to create your select input which you want to turn into a multiselect. Remember to set the multiple attribute as to get a real multiselect - but do not worry, the plugin can also be used as usual select without the multiple attribute being present.
-
+
+ Now simply use HTML to create your select input which you want to turn into a
+ multiselect. Remember to set the multiple attribute as to get a real multiselect -
+ but do not worry, the plugin can also be used as usual select without the multiple
+ attribute being present.
+
<!-- Build your select: -->
@@ -112,30 +126,31 @@
Create a Select
<option value="onions">Onions</option>
</select>
-
-
-
Call the Plugin
+
+
+
Call the Plugin
-
- In the end, simply call the plugin on your select. You may also specify further options, see the Options tab for further information.
-
+
+ In the end, simply call the plugin on your select. You may also specify further
+ options, see the Options tab for further information.
+
- Use Firebug, Chrome Developer Tools to get the best out of the below examples.
-
-
-
-
-
-
multiple
-
-
- multiple is not a real configuration option. It refers to the multiple attribute of the select the plugin is applied on. When the multiple attribute of the select is present, the plugin uses checkboxes to allow multiple selections. If it is not present, the plugin uses radio buttons to allow single selections. When using the plugin for single selections (without the multiple attribute present), the first option will automatically be selected if no other option is selected in advance. See #129 for how to avoid this behavior.
-
-
-
- The following example shows the default behavior when the multiple attribute is omitted:
-
+ Use Firebug, Chrome Developer Tools to get the best out of the below examples.
+
+
+
+
+
+
multiple
+
+
+ multiple is not a real configuration option. It refers to the
+ multiple attribute of the select the plugin is applied on. When
+ the multiple attribute of the select is present, the plugin uses
+ checkboxes to allow multiple selections. If it is not present, the plugin uses radio buttons
+ to allow single selections. When using the plugin for single selections (without the multiple
+ attribute present), the first option will automatically be selected if no other option is
+ selected in advance. See #129 for how
+ to avoid this behavior.
+
+
+
+ The following example shows the default behavior when the multiple attribute is
+ omitted:
+
- If multiple options are selected in advance and the select lacks the multiple attribute, the last option marked as selected will initially be selected by the plugin.
-
-
-
-
-
-
-
+
+
+
+ If multiple options are selected in advance and the select lacks the multiple
+ attribute, the last option marked as selected will initially be selected by the
+ plugin.
+
- The following example shows the default behavior when the multiple attribute is present. Initially selected options will be adopted automatically:
-
-
-
-
-
-
-
+
+
+
+ The following example shows the default behavior when the multiple attribute is
+ present. Initially selected options will be adopted automatically:
+
- The plugin naturally supports optgroup's, however the group headers are not clickable by default. See the enableClickableOptGroups option for details.
-
-
-
-
-
-
+
+
+ The plugin naturally supports optgroup's, however the group headers are not
+ clickable by default. See the enableClickableOptGroups option for details.
+
- XSS injection is a serious thread for all modern web applications. Setting enableHTML to false (default setting) will create a XSS save multiselect.
-
-
-
-
-
-
-
+
+
+
+
+
enableHTML
+
+
+ XSS injection is a serious thread for all modern web applications. Setting
+ enableHTML to false (default setting) will create a XSS save
+ multiselect.
+
- Note that the behavior of onChange changes. Whenever an optgroup is changed/clicked, the onChange event is fired with all affected options as first parameter.
-
-
-
-
-
-
-
+
+
+
+ Note that the behavior of onChange changes. Whenever an optgroup is
+ changed/clicked, the onChange event is fired with all affected options as first
+ parameter.
+
- The text shown if the multiselect is disabled. Note that this option is set to the empty string '' by default, that is nonSelectedText is shown if the multiselect is disabled and no options are selected.
-
-
-
-
-
-
-
+
+
+
+
+
disabledText
+
+
+ The text shown if the multiselect is disabled. Note that this option is set to the empty
+ string '' by default, that is nonSelectedText is shown if the
+ multiselect is disabled and no options are selected.
+
- The dropdown can also be dropped up. Note that it is recommended to also set maxHeight. The plugin calculates the necessary height of the dropdown and takes the minimum of the calculated value and maxHeight.
-
-
-
- Note that this feature has been introduced in #594 and is known to have issues depending on the environment.
-
+ The dropdown can also be dropped up. Note that it is recommended to also set
+ maxHeight. The plugin calculates the necessary height of the dropdown and takes
+ the minimum of the calculated value and maxHeight.
+
+
+
+ Note that this feature has been introduced in #594 and is
+ known to have issues depending on the environment.
+
- A function which is triggered on the change event of the options. Note that the event is not triggered when selecting or deselecting options using the select and deselect methods provided by the plugin.
-
-
-
- Note that the behavior of onChange changes when setting enableClickableOptGroups to true.
-
-
-
-
-
-
-
+
+
+
+
+
onChange
+
+
+ A function which is triggered on the change event of the options. Note that the event is not
+ triggered when selecting or deselecting options using the select and deselect
+ methods provided by the plugin.
+
+
+
+ Note that the behavior of onChange changes when setting enableClickableOptGroups
+ to true.
+
- A callback specifying the text shown on the button dependent on the currently selected options.
-
-
-
- The callback gets the currently selected options and the select as argument and returns the string shown as button text. The default buttonText callback returns nonSelectedText in the case no option is selected, nSelectedText in the case more than numberDisplayed options are selected and the names of the selected options if less than numberDisplayed options are selected.
-
- A callback specifying the title of the button.
-
-
-
- The callback gets the currently selected options and the select as argument and returns the title of the button as string. The default buttonTitle callback returns nonSelectedText in the case no option is selected and the names of the selected options of less than numberDisplayed options are selected. If more than numberDisplayed options are selected, nSelectedText is returned.
-
- Setting both includeSelectAllOption and enableFiltering to true, the select all option does always select only the visible option. With setting selectAllJustVisible to false this behavior is changed such that always all options (irrespective of whether they are visible) are selected.
-
-
-
-
-
-
-
+
+
+
+
+
+ selectAllJustVisible
+
+
+
+ Setting both includeSelectAllOption and enableFiltering to true,
+ the select all option does always select only the visible option. With setting selectAllJustVisible
+ to false this behavior is changed such that always all options (irrespective of
+ whether they are visible) are selected.
+
- The select all option is added as additional option within the select. To distinguish this option from the original options the value used for the select all option can be configured using the selectAllValue option.
-
-
-
-
-
-
-
+
+
+
+
+
+ selectAllValue
+
+
+
+ The select all option is added as additional option within the
+ select. To distinguish this option from the original options the value used for
+ the select all option can be configured using the selectAllValue option.
+
- If set to true (default), the number of selected options will be shown in parantheses when all options are seleted. The below example shows the behavior of the selectalloption with selectAllNumber set to false:
-
-
-
-
-
-
-
+
+
+
+
+
+ selectAllNumber
+
+
+
+ If set to true (default), the number of selected options will be shown in
+ parantheses when all options are seleted. The below example shows the behavior of the
+ selectalloption with selectAllNumber set to false:
+
- This function is triggered when the select all option is used to select all options. Note that this can also be triggered manually using the .multiselect('selectAll') method.
-
-
-
-
-
-
-
+
+
+
+
+
+ onSelectAll
+
+
+
+ This function is triggered when the select all option is used to select all options. Note
+ that this can also be triggered manually using the .multiselect('selectAll')
+ method.
+
- The filter as configured above will use case sensitive filtering, by setting enableCaseInsensitiveFiltering to true this behavior can be changed to use case insensitive filtering.
-
-
-
-
-
-
-
+
+
+
+
+
+ enableCaseInsensitiveFiltering
+
+
+
+ The filter as configured above will use case sensitive filtering, by setting enableCaseInsensitiveFiltering
+ to true this behavior can be changed to use case insensitive filtering.
+
- The generated HTML markup can be controlled using templates. Basically, templates are simple configuration options. The default templates are shown below:
-
-
-
- However, note that messing with the template's classes may cause unexpected behavior. For example the button should always have the class .multiselect,
-
-
-
- In addition, note that other options may also have influence on the templates, for example the buttonClass option.
-
+
+
Templates
+
+
+
+
+ The generated HTML markup can be controlled using templates. Basically, templates are simple
+ configuration options. The default templates are shown below:
+
+
+
+ However, note that messing with the template's classes may cause unexpected behavior. For example the
+ button should always have the class .multiselect,
+
+
+
+ In addition, note that other options may also have influence on the templates, for example the buttonClass
+ option.
+
- This method is used to refresh the checked checkboxes based on the currently selected options within the select. Click 'Select some options' to select some of the options. Then click refresh. The plugin will update the checkboxes accordingly.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ .multiselect('refresh')
+
+
+
+ This method is used to refresh the checked checkboxes based on the currently selected
+ options within the select. Click 'Select some options' to select some
+ of the options. Then click refresh. The plugin will update the checkboxes accordingly.
+
- The method provides an additional parameter: .multiselect('select', value, triggerOnChange). If the second parameter is set to true, the method will manually trigger the onChange option.
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ The method provides an additional parameter: .multiselect('select', value,
+ triggerOnChange). If the second parameter is set to true, the method will manually
+ trigger the onChange option.
+
- The method provides an additional parameter: .multiselect('deselect', value, triggerOnChange). If the second parameter is set to true, the method will manually trigger the onChange option.
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ The method provides an additional parameter: .multiselect('deselect', value,
+ triggerOnChange). If the second parameter is set to true, the method will manually
+ trigger the onChange option.
+
- Selects all options. If justVisible is set to true or not provided, all visible options are selected (when using the filter), otherweise (justVisible set to false) all options are selected.
-
-
-
- Note that setting justVisible to true, or providing no parameter will select all visible options, that is the dropdown needs to be opened.
-
-
-
- Currently, it is required to call .multiselect('updateButtonText') manually after calling .multiselect('selectAll', justVisible).
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ .multiselect('selectAll', justVisible)
+
+
+
+ Selects all options. If justVisible is set to true or not
+ provided, all visible options are selected (when using the filter), otherweise (justVisible
+ set to false) all options are selected.
+
+
+
+ Note that setting justVisible to true, or providing no parameter
+ will select all visible options, that is the dropdown needs to be opened.
+
+
+
+ Currently, it is required to call .multiselect('updateButtonText') manually
+ after calling .multiselect('selectAll', justVisible).
+
- Deselects all options. If justVisible is set to true or not provided, all visible options are deselected, otherweise (justVisible set to false) all options are deselected.
-
-
-
- Note that setting justVisible to true, or providing no parameter will select all visible options, that is the dropdown needs to be opened.
-
-
-
- Currently, it is required to call .multiselect('updateButtonText') manually after calling .multiselect('selectAll', justVisible).
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ .multiselect('deselectAll', justVisible)
+
+
+
+ Deselects all options. If justVisible is set to true or not
+ provided, all visible options are deselected, otherweise (justVisible set to
+ false) all options are deselected.
+
+
+
+ Note that setting justVisible to true, or providing no parameter
+ will select all visible options, that is the dropdown needs to be opened.
+
+
+
+ Currently, it is required to call .multiselect('updateButtonText') manually
+ after calling .multiselect('selectAll', justVisible).
+
- When manually selecting/deselecting options and the corresponding checkboxes, this function updates the text and title of the button.
-
-
-
- Note that usually this method is only needed when using .multiselect('selectAll', justVisible) or .multiselect('deselectAll', justVisible). In all other cases, .multiselect('refresh') should be used.
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ .multiselect('updateButtonText')
+
+
+
+ When manually selecting/deselecting options and the corresponding checkboxes, this function
+ updates the text and title of the button.
+
+
+
+ Note that usually this method is only needed when using .multiselect('selectAll',
+ justVisible) or .multiselect('deselectAll', justVisible). In all other
+ cases, .multiselect('refresh') should be used.
+
- Limit the number of selected options using the onChange option. The user may only select a maximum of 4 options. Then all other options are disabled.
-
- Simulate single selections using checkboxes. The behavior will be similar to a multiselect with radio buttons except that the selected option can be deselected again.
-