带有搜索框的单个下拉列表 [英] Single Dropdown with search box in it
本文介绍了带有搜索框的单个下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将搜索框添加到单个选择下拉选项中.
代码:
如上添加输入标签不起作用.
我尝试过使用 html5-datalist 并且它有效.我想要一些其他选项,因为 html5-datalist 不支持 chrome 中的可滚动选项.
有人可以建议任何其他搜索框选项吗?它们应该与 django-python 框架兼容.
解决方案
只需使用select2插件即可实现此功能
插件链接:
I want to add search box to a single select drop down option.
Code:
<select id="widget_for" name="{{widget_for}}">
<option value="">select</option>
{% for key, value in dr.items %}
<input placeholder="This ">
<option value="{% firstof value.id key %}" {% if key in selected_value %}selected{% endif %}>{% firstof value.name value %}</option>
{% endfor %}
</select>
Adding a input tags as above does not work out.
I have tried using html5-datalist and it works. I want some other options as html5-datalist does not support scrollable option in chrome.
Can anyone suggest any other searchbox options? They should be compatible with django-python framework.
解决方案
Simply use select2 plugin to implement this feature
Plugin link: Select2
这篇关于带有搜索框的单个下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文