This time I will share jQuery Plugin and tutorial about Fully Customizable jQuery Select Element Plugin – Multiselect, hope it will help you in programming stack.
Multiselect is a tiny jQuery select replacement plugin that transforms the regular multiple select into a dual list box interface.
Features:
- Keyboard interactions.
- Moves options between 2 side-by-side lists by click.
- Supports native Optgroup, Selected, Disabled attributes.
How to use it:
1. Include jQuery library and the multiselect plugin’s files on the web page.
1 |
< link href = "/path/to/css/multiselect.css" rel = "stylesheet" /> |
2 |
< script src = "/path/to/cdn/jquery.js" ></ script > |
3 |
< script src = "/path/to/js/jquery.multi-select.js" ></ script > |
2. Call the function multiSelect()
on the existing select element and the plugin will do the rest.
1 |
< select multiple = "multiple" id = "example" name = "example[]" > |
2 |
< option value = "option 1" >Option 1</ option > |
3 |
< option value = "option 2" >Option 2</ option > |
4 |
< option value = "option 3" >Option 3</ option > |
5 |
< option value = "option 4" >Option 4</ option > |
7 |
< option value = "option n" >Option n</ option > |
1 |
$( '#example' ).multiSelect(); |
4. Override the default settings to customize the plugin.
01 |
$( '#example' ).multiSelect({ |
04 |
selectableOptgroup: false , |
07 |
disabledClass : 'disabled' , |
19 |
selectableHeader: null , |
20 |
selectionHeader: null , |
21 |
selectableFooter: null , |
5. Callback functions available.
01 |
$( '#example' ).multiSelect({ |
03 |
afterInit: function (container){ |
06 |
afterSelect: function (values){ |
09 |
afterDeselect: function (values){ |
6. API methods.
02 |
$( '#example' ).multiSelect( 'addOption' , { |
06 |
nested: 'optgroup_label' |
10 |
$( '#example' ).multiSelect( 'select' , String|Array); |
13 |
$( '#example' ).multiSelect( 'deselect' , String|Array); |
16 |
$( '#example' ).multiSelect( 'select_all' ); |
19 |
$( '#example' ).multiSelect( 'deselect_all' ); |
22 |
$( '#example' ).multiSelect( 'refresh' ); |
Change log:
v0.9.12 (2019-12-26)
This awesome jQuery plugin is developed by lou. For more Advanced Usages, please check the demo page or visit the official website.