【发布时间】:2017-09-27 08:52:06
【问题描述】:
所以我使用 bootstrap 做了一个下拉菜单。
我在这里拿的代码: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>
现在我想在下拉列表中添加一个搜索框,以便人们可以输入,它会缩短为更合适的下拉列表。
我尝试找到很多方法,其中一些使用外部插件,例如 Select2,但是,它们需要使用 <select> 和 <option> 标签编码的下拉列表。相比之下,我的代码使用了按钮和 Bootstrap 的内置下拉类。
请任何人帮助我。
【问题讨论】:
-
您希望下拉列表根据搜索字段中的输入进行过滤吗?或者您对 html 有问题,将输入字段放在下拉列表中?
-
是的,我希望下拉列表根据输入搜索进行过滤
-
这个问题和 Jira 有什么关系?
标签: javascript drop-down-menu jira bootstrap-4 search-box