admin管理员组文章数量:1431413
Im having trouble with bootstrap selectpicker and bootstraps "has-error" class. If an select tag has "has-error" class without selectpicker then a red border is niceley displayed around it. When i add the selectpicker then it is not. What can i do so that "has-error" will display a red border around select tag with bootstrap selectpicker?
jsfiddle: /
code:
<div class="form-group has-error">
<select class="form-control">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
</div>
// include next line to see that red border dissapears
// $('select').selectpicker();
Im having trouble with bootstrap selectpicker and bootstraps "has-error" class. If an select tag has "has-error" class without selectpicker then a red border is niceley displayed around it. When i add the selectpicker then it is not. What can i do so that "has-error" will display a red border around select tag with bootstrap selectpicker?
jsfiddle: http://jsfiddle/mfrup5bL/149/
code:
<div class="form-group has-error">
<select class="form-control">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
</div>
// include next line to see that red border dissapears
// $('select').selectpicker();
Share
Improve this question
asked Nov 7, 2017 at 20:06
user1985273user1985273
1,96719 gold badges52 silver badges92 bronze badges
3 Answers
Reset to default 5You can add this style:
.has-error .form-control > .selectpicker {
border-color: #a94442;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
}
See a demo here.
You could add the color to the element that is created by the selectpicker...
button.btn.dropdown-toggle.selectpicker.btn-default {
border-color: rgb(169, 68, 66);
}
To avoid CSS overriding, you could update bootstrap-select to the latest version which provides the required styling.
本文标签: javascriptBootstrap selectpicker does not work with bootstrap quothaserrorquot classStack Overflow
版权声明:本文标题:javascript - Bootstrap selectpicker does not work with bootstrap "has-error" class - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745492898a2660681.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论