@khairnar2960/bsselect
v1.6.1
Published
Bootstrap 5 select with search box in 3 different variants
Downloads
8
Maintainers
Readme
BSSelect
A quick function to allow search in HTML select box.
new BSSelect(selector, options);
- selector
(Selector|Node)
- options
object
Deployment:
To use BSSelect you must include Bootstrap 5 CSS & JS
files first
Using BSSelect.js file
<script src="BSSelect.min.js"></script>
Using jsDeliver CDN
<script src="https://cdn.jsdelivr.net/npm/@khairnar2960/[email protected]/BSSelect.min.js"></script>
Using unpkg CDN
<script src="https://unpkg.com/@khairnar2960/[email protected]/BSSelect.min.js"></script>
Uses:
No option use
<select class="form-select" id="demo">
<option>Select city</option>
<option>Delhi</option>
<option>Mumbai</option>
<option>Kolkata</option>
<option>Indore</option>
<option>Chennai</option>
</select>
<script>
window.addEventListener('load', function(e) {
const select = new BSSelect('#demo');
});
</script>
Small variation
<script>
window.addEventListener('load', function(e) {
const select = new BSSelect('#demo', {size: 'sm'});
});
</script>
Large variation
<script>
window.addEventListener('load', function(e) {
const select = new BSSelect('#demo', {size: 'lg'});
});
</script>