- Posted On 16 December 2014
- In Programming
This post covers information about how to implement Bootstrap Multiselect jQuery plugin in HTML with different options such as filter and select all functionality.
Many of the application now days requires such kind of multiselect option which provides easy input facility for the user. Let's see how to implement this plugin.
First of all you need a reference files of bootstrap and jQuery included in your application or page then you need to include reference bootstrap-multiselect.js and bootstrap-multiselect.css which you can download from here.
Then suppose you have defined a HTML mark up for select options like below.
<select id="ddlCars" multiple="multiple"> <option value="Accord">Accord</option> <option value="Duster">Duster</option> <option value="Esteem">Esteem</option> <option value="Fiero">Fiero</option> <option value="Lancer">Lancer</option> <option value="Phantom">Phantom</option> </select>
Now you need to call jQuery code like following to convert this normal select to multiselect.
That's it. Now if you run your site or page you will find an awesome multiselect i.e. dropdown with checkbox list.
This plugin has several inbuilt properties and method to get this control worked in most kind of functionality, out of which below are some frequently needed properties.
numberDisplayed : This property controls after how much items control start displaying "..Selected" Text.
includeSelectAllOption : This flag allows you to provide select all functionality within the control.
enableFiltering : This flag allows you to provide search box to filter items.
nonSelectedText : This property allows you to change the default "None Selected" text when no items selected to any custom text.
Below is the live working fiddle with all above functionalities.
Let me know your opinion about this plugin and do share if you know any other better plugin. Thanks.
Swagger - Powerful Opensource Framework for RESTful API
With a Swagger-enabled API, you get interactive documentation, client SDK generation and discoverability. Swagger Editor allows you to generate code, documentation with ease.
Visual Studio Code - Lighweight but powerful source code editor available for Windows, OS X and Linux
How to post JSON string as a string in jQuery AJAX
Know how to post JSON String as string to the action method of controller in MVC.
How to call click or any event only once in jQuery
Know how to execute an click event or any event only once for any element in jQuery. Perform action only once and even not required to unbind event.