This time I will share jQuery Plugin and tutorial about User-friendly Multi-select List Plugin With jQuery – multi-list, hope it will help you in programming stack.
A convenient jQuery multiple select plugin that transforms any unordered list into a filterable select list with checkboxes for easier item selection.
View more Multi Select plugins at:
How to use it:
1. Add references to jQuery library and the jQuery multi-list plugin’s files into the webpage.
1 |
< link rel = "stylesheet" href = "multi-list.css" > |
2 |
< script src = "//code.jquery.com/jquery.min.js" ></ script > |
3 |
< script src = "multi-list.js" ></ script > |
2. Create a regular html unordered list as this:
2 |
< li value = "AF" >Afghanistan</ li > |
3 |
< li value = "AX" >Åland Islands</ li > |
4 |
< li value = "AL" >Albania</ li > |
5 |
< li value = "DZ" >Algeria</ li > |
6 |
< li value = "AS" >American Samoa</ li > |
3. Call the function on the list and the plugin will do the rest.
1 |
$( "#list" ).multiList(); |
4. API methods.
02 |
$( "<ul>" ).multiList( "getSelected" ); |
05 |
$( "<ul>" ).multiList( "getSelectedFull" ); |
08 |
$( "<ul>" ).multiList( "getUnselected" ); |
11 |
$( "<ul>" ).multiList( "getUnselectedFull" ); |
14 |
$( "<ul>" ).multiList( "select" , "<li> value" ); |
17 |
$( "<ul>" ).multiList( "unselect" , "<li> value" ); |
20 |
$( "<ul>" ).multiList( "selectAll" ); |
23 |
$( "<ul>" ).multiList( "unselectAll" ); |
26 |
$( "<ul>" ).multiList( "hide" , "<li> value" ); |
29 |
$( "<ul>" ).multiList( "show" , "<li> value" ); |
32 |
$( "<ul>" ).multiList( "hideAll" ); |
35 |
$( "<ul>" ).multiList( "showAll" ); |
38 |
$( "<ul>" ).multiList( "disable" ); |
41 |
$( "<ul>" ).multiList( "enable" ); |
44 |
$( "<ul>" ).multiList( "setName" , "<li> value" , "<li> new name" ); |
5. Events.
- “multiList.elementUnchecked”: Triggered when unchecking an item. Params passed: “value” (the “value” attr from the li items) and “text” (the full text)
- “multiList.elementChecked”: Triggered when checking an item. Params passed: “value” (the “value” attr from the li items) and “text” (the full text)
Change log:
2018-04-04
2018-04-03
- fixed select all with hidden elements
2018-03-02
2017-07-25
- label tag now with style “display inherit”
2017-06-27
- Improved the selectable area for each list item
This awesome jQuery plugin is developed by koopaconan. For more Advanced Usages, please check the demo page or visit the official website.