更改bootstrap select的边框颜色(btn类)

问题描述 投票:0回答:1

我正在使用这个库:https://developer.snapappointments.com/bootstrap-select/但是我在选择时无法改变它的行为。例如

<select class="selectpicker">
  <option>Mustard</option>
  <option>Ketchup</option>
  <option>Barbecue</option>
</select>

其中selectpicker是创建此结构的关键:

<button type="button" class="btn dropdown-toggle btn-new" data-toggle="dropdown" role="button" data-id="blabla" title="Mustard" aria-expanded="true">
<div class="filter-option"><div class="filter-option-inner"><div class="filter-option-inner-inner">Mustard</div></div> 
</div>
</button>

所以,主要是,库在select上创建一个按钮(存在但隐藏)。我想要的是,当我选择列表中的一个项目时,边框颜色(按钮而不是选择)改变颜色在#BF69B2我尝试过这样:

document.getElementsByClassName("btn dropdown-toggle btn-default")[0].style.borderColor = "#BF69B2";

但没有成功。任何的想法?

javascript jquery css bootstrap-select
1个回答
1
投票

您正在尝试使用类qazxsw poi检索元素,但在模板中您有另一个类:qazxsw poi。

只是改变

btn dropdown-toggle btn-default

btn dropdown-toggle btn-new
© www.soinside.com 2019 - 2024. All rights reserved.