Bootstrap Multiselect Dropdown with Checkboxes

Bootstrap Multiselect Dropdown with Checkboxes
Code Snippet:Bootstrap Multiselect
Author: David Stutz
Published: January 17, 2024
Last Updated: January 22, 2024
Downloads: 137,039
License: MIT
Edit Code online: View on CodePen
Read More

A lightweight jQuery plugin for Bootstrap to create multiselect dropdown with checkboxes. It adds the functionality to HTML select elements for multiple selections with check-boxes.

How to Use Bootstrap Multiselect Dropdown

1. First of all load the jQuery and Bootstrap framework into your HTML document.

<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>

<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<!-- Bootstrap JS -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

2. After this, include the Bootstrap multiselect‘s CSS and JavaScript file to your page.

<!-- Bootstrap Multiselect CSS -->
<link rel="stylesheet" href="css/bootstrap-multiselect.css">

<!-- Bootstrap Multiselect JS -->
<script data-main="dist/js/" src="js/require.min.js"></script>

3. Now create HTML select element with your list of options with a unique id. Just like below.

<select id="mySelect" multiple="multiple">
<option value="Option one">Option one</option>
<option value="Option two">Option two</option>
<option value="Option three">Option three</option>
<option value="Option four">Option four</option>
<option value="Option five">Option five</option>
<option value="Option six">Option six</option>
</select>

4. And Finally call the plugin to active the multiselect.

<script>
require(['bootstrap-multiselect'], function(purchase){
$('#mySelect').multiselect();
});
</script>

Advanced Configuration Options for Multiselect Dropdown with Checkboxes

Visit the demo page for advanced configuration options to create a Bootstrap multiselect dropdown with checkboxes.

1 thought on “Bootstrap Multiselect Dropdown with Checkboxes”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...