popup multi select - Free Download Select Multiple Options From A Popup - jQuery popupMultiSelect

Free Download Select Multiple Options From A Popup – jQuery popupMultiSelect

Posted on

This time I will share jQuery Plugin and tutorial about Select Multiple Options From A Popup – jQuery popupMultiSelect, hope it will help you in programming stack.

popup multi select - Free Download Select Multiple Options From A Popup - jQuery popupMultiSelect
File Size: 309 KB
Views Total: 3520
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

popupMultiSelect is a jQuery/Bootstrap plugin that converts the regular select element into a user-friendly multi select & tags input component.

The plugin enables the user to select multiple options from a popup instead of the dropdown list. Requires the Bootstrap’s modal component.

See It In Action:

How to use it:

1. Include the required jQuery library and Bootstrap 4 framework on the page.

1 <link rel="stylesheet" href="/path/to/cdn/bootstrap.min.css" />
2 <script src="/path/to/cdn/jquery.slim.min.js"></script>
3 <script src="/path/to/cdn/bootstrap.min.js"></script>

2. Download and include the popupMultiSelect plugin on the page.

1 <link rel="stylesheet" href="./dist/stylesheets/popup-multiselect.min.css" />
2 <script src="./dist/javascripts/popup-multiselect.min.js"></script>

3. Attach the function multiselect to the multiple select and done.

1 <select multiple name="vehicle[autos]" id="example">
2   <option value="volvo">Volvo</option>
3   <option value="saab">Saab</option>
4   <option value="opel">Opel</option>
5   <option value="audi">Audi</option>
6 </select>
1 $(function(){
2   $("#example").multiselect();
3 });

4. Set the maximum number of options allowed to select.

1 $(function(){
2   $("#example").multiselect({
3     maxSelectionAllowed: 5
4   });
5 });

5. Enable/disable the animation. Default: true.

1 $(function(){
2   $("#example").multiselect({
3     animation: true
4   });
5 });

6. Set the modal size. Default: ‘sm’.

1 $(function(){
2   $("#example").multiselect({
3     modalSize: "md" // 'lg', 'xl'
4   });
5 });

7. Customize the placeholder text.

1 $(function(){
2   $("#example").multiselect({
3     title: "Select Options"
4   });
5 });

8. Customize the rendering templates.

01 $(function(){
02   $("#example").multiselect({
03     selectTemplate:
04       '<div class="selectWrap clearfix"><span class="select-content"></span><a href="#" class="open-options clickable"><span class="icon icon-list">&#9776;</span></a></div>',
05     selectOptionTemplate:
06       '<span class="addedOption" ><span class="text"></span><span class="clickable removeOption"><span class="icon icon-remove" aria-hidden="true">&#9747;</span></span></span>',
07     modalTemplate:
08       '<div class="select modal in" aria-hidden="false"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><div><h5 class="modal-title"></h5><div class="help-block"></div></div><span class="float-right clickable close" aria-hidden="true">&#9747;</span></div><div class="modal-body"></div></div></div></div>',
09     modalOptionTemplate:
10       '<div class="option clickable"><span class="option-text"></span><span class="option-tick"><span class="icon icon-ok" aria-hidden="true">&#x2713;</span></span></div>',
11   });
12 });

9. API methods.

01 // Enable/disable
02 $("#example").multiselect("enable");
03 $("#example").multiselect("disable");
04  
05 // Toggle the modal popup
06 $("#example").multiselect("show");
07 $("#example").multiselect("hide");
08  
09 // Select an option
10 $("#example").multiselect("selectOption", value);
11  
12 // Deselect an option
13 $("#example").multiselect("deselectOption", value);
14  
15 // Add an new option
16 $("#example").multiselect("addOption",{
17   value: "OTHER",
18   html: "OTHER",
19   selected: true
20 });

10. Event handlers.

01 $("#example").on("enabled.bs.multiselect", function(event) {
02   // do something
03 });
04  
05 $("#example").on("disabled.bs.multiselect", function(event) {
06   // do something
07 });
08  
09 $("#example").on("show.bs.multiselect", function(event) {
10   // do something
11 });
12  
13 $("#example").on("shown.bs.multiselect", function(event) {
14   // do something
15 });
16  
17 $("#example").on("hide.bs.multiselect", function(event) {
18   // do something
19 });
20  
21 $("#example").on("hidden.bs.multiselect", function(event) {
22   // do something
23 });
24  
25 $("#example").on("selected.bs.multiselect", function(event, option) {