Requires jQuery v1.8.0+, Bootstrap’s dropdown.js component, and Bootstrap’s CSS. If you’re not already using Bootstrap in your project, a precompiled version of the minimum requirements can be downloaded here.
The folks at CDNJS host a copy of the library. The CDN is updated after the release is made public, which means there is a delay between the publishing of a release and its availability on the CDN, so keep that in mind. Just use these links:
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/css/bootstrap-select.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/js/bootstrap-select.min.js"></script>
<!-- (Optional) Latest compiled and minified JavaScript translation files -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/js/i18n/defaults-*.min.js"></script>
You can also install bootstrap-select using Bower:
$ bower install bootstrap-select
You can also install bootstrap-select using npm:
$ npm install bootstrap-select
You can also install bootstrap-select using NuGet:
$ Install-Package bootstrap-select
Create your <select>
with the .selectpicker
class. The data-api will automatically theme these elements.
<select class="selectpicker">
<option>Mustard</option>
<option>Ketchup</option>
<option>Relish</option>
</select>
Options can be passed via data attributes or JavaScript.
$('.selectpicker').selectpicker({
style: 'btn-info',
size: 4
});