Recently, I created a dropdown menu using Bootstrap.
The code I used can be found here: http://getbootstrap.com/docs/4.0/components/dropdowns/
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown button
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
Now, I am looking to enhance my dropdown by adding a search box inside it. This will allow users to type and filter the options in the dropdown list.
After trying various methods, including using external plugins like Select2, I encountered an issue. These plugins require dropdowns to be coded using <select>
and <option>
tags. However, my dropdown is built using buttons and the built-in Bootstrap dropdown class.
If anyone has any suggestions or solutions, please help me out.