Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

48 Commits

Repository files navigation

jQuery MultiSelect

Turn a multiselect list into a nice and easy to use list with checkboxes.

Demo

http://springstubbe.us/projects/demos/jquery-multiselect/

Usage

$('select[multiple]').multiselect();
$('select[multiple]').multiselect({
columns: 4,
texts: {
placeholder: 'Select options'
}
});
$('select[multiple]').multiselect('reload');
$('select[multiple]').multiselect( 'loadOption', [{
name : 'Option Name 1',
value : 'option-value-1',
checked: false
},{
name : 'Option Name 2',
value : 'option-value-2',
checked: false
}]);

If your list is not visible on page load, add the jquery.actual plugin to your project. This will allow proper width calculations to happen.

Options

OptionValuesDefaultDescription
columnsint1# of columns to show options
searchboolfalseenable option search/filering
searchOptionsobject
- showOptGroupsboolfalseshow option group titles if no options remaining
- onSearchfunctionfires before search on options happens
textsobject
- placeholderstringSelect optionsdefault text for dropdown
- defaultstringSearchsearch input placeholder text
- selectedOptionsstringselectedselected suffix text
- selectAllstringSelect allselect all text
- noneSelectedstringNone SelectedNone selected text
selectAllboolfalseadd select all option
selectGroupboolfalseadd select all optgroup option
minHeightnumber200min height of option overlay
maxHeightnumbernullmax height of option overlay
showCheckboxbooltruedisplay the option checkbox
onLoadfunctionfires at end of initial loading, hides native select list
onOptionClickfunctionfires after on option is clicked and selected
jqActualOptsobjectnulloptions for jquery.actual

Methods

loadOptions( options, overwrite )

Update options of select list. Default state will replace existing list with this one. Set the second parameter to false to append to the list.

This will NOT modify the original select list element.

$('select[multiple]').multiselect( 'loadOption', [{
name : 'Option Name 1',
value : 'option-value-1',
checked: false
},{
name : 'Option Name 2',
value : 'option-value-2',
checked: false
}]);

unload

Disable the jquery multiselect list and show the native select list.

This is distructive. You will have to reinitialize with all options to enable the plugin for the list.

$('select[multiple]').multiselect( 'unload' );

reload

This is a quick unload/load while maintaining options during plugin initialization.

$('select[multiple]').multiselect( 'reload' );

Callbacks

onLoad

Fires after initial loading and hides native select list

onLoad( element )

element: select list element object

onOptionClick

Fires after an option is clicked and selected

onOptionClick( element, option )

element: select list element object

option: option element object

onSearch

Fires before search on options happens

searchOptions.onSearch( element )

element: select list element object

About

Turn a multiselect list into a nice and easy to use list with checkboxes.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages