javascript - Select2 搜索字段上的搜索图标

标签 javascript jquery twitter-bootstrap jquery-select2

我将 select2 与 bootstrap3 结合使用。

https://select2.github.io/examples.html

单选框

如何在搜索栏添加搜索图标?

像这样:

https://fk.github.io/select2-bootstrap-css/

这是我的 Select2 选项代码:

$(".select2").select2({
    theme: 'bootstrap'
});

这是我的 HTML 代码:

<select style="width:100%" class="select2">
    <optgroup label="Test-group">
        <option>test1</option>
        <option>test2</option>
    </optgroup>
</select>

谢谢。

最佳答案

检查你的html并找到输入的css规则,然后为其添加背景,如下所示: 背景:#fff url('select2.png') no-repeat 100% -22px;

关于javascript - Select2 搜索字段上的搜索图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39323333/

相关文章:

javascript - Node.js:如何使用 proxyquire 替换 neo4j-driver 依赖

javascript - promise 并修改返回值

jquery - 为什么 jQuery Ajax 在 Cordova iOS 应用程序中不起作用

ruby-on-rails - Bootstrap 和 Rails 有什么区别?

javascript - 随机化图像淡入

javascript - 当我快速滚动时,Intersection Observer 有时会失败

javascript - 如何隐藏图表工具提示的标题?

jquery跨不同 Pane 的可排序列表

javascript - 当元素底部超过点时移除类

css - Bootstrap select 在 autopostback 后丢失样式