Please consult the FAQ, the Issue Tracker or StackOverflow before creating a new issue; when creating an issue or a pull request, read how to contribute first.
Getting started with Bootstrap Multiselect and Require JS":
<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"/> <link rel="stylesheet" href="css/bootstrap-multiselect.css" type="text/css"/>
<script data-main="dist/js/" src="js/require.min.js"></script>
Now simply use HTML to create your select
input which you want to turn into a multiselect. Remember to set the multiple
attribute as to get a real multiselect - but do not worry, the plugin can also be used as usual select without the multiple
attribute being present.
<!-- Build your select: --> <select id="example-getting-started" multiple="multiple"> <option value="cheese">Cheese</option> <option value="tomatoes">Tomatoes</option> <option value="mozarella">Mozzarella</option> <option value="mushrooms">Mushrooms</option> <option value="pepperoni">Pepperoni</option> <option value="onions">Onions</option> </select>
In the end, simply call the plugin on your select
:
Note that in this example, jQuery is included manually due to the file structure of this documentation; however this is not necessary.
<!-- Initialize the plugin: -->
<script type="text/javascript">
require(['bootstrap-multiselect'], function(purchase){
$('#example-getting-started').multiselect();
});
</script>
© 2012 - 2018 David Stutz - dual licensed: Apache License v2.0, BSD 3-Clause License