Bootstrap-select 选项 select 时的背景颜色

Bootstrap-select background color when an option is selected

在我的SELECT中,当我select一个选项时,只有里面的部分变成了黄色。我希望整个 select 字段变成黄色。

这是我的代码:

.bootstrap-select.btn-group .dropdown-toggle:not([title=""]) .filter-option {
      background-color: yellow !important;
}
<select class="selectpicker form-control" data-size="40px" data-width="210px" 
    style="height: 80px" data-live-search="true" data-none-Selected-Text="" 
    data-hide-disabled="true" data-container="body" name="mittente_nucleo" 
    id="mittente_nucleo">
    <option></option>
    <option>1</option>
    <option>2</option>
</select>

JSFiddle

您可以使用 jQuery 事件更改背景颜色

$('#mittente_nucleo').on('change', function(){
           var selected = $('#mittente_nucleo option:selected').val();
           var element = $('button[data-id="mittente_nucleo"]');
           element.css("background-color", "yellow");
});

JSFiddle https://jsfiddle.net/yrtd7oa4/