如何将无线电功能添加到Bootstrap按钮组

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

引导程序2具有data-toggle属性,可以将其设置为buttons-radio,例如:

  <div class="btn-group" data-toggle="buttons-radio">
   <button id="1" class="btn">One</button>
   <button id="2" class="btn">Two</button>
   <button id="3" class="btn">Three</button>
  </div>

现在,我需要在具有Bootstrap 3的按钮组中具有相同的功能。如何在按钮之间切换活动类?

twitter-bootstrap twitter-bootstrap-3
1个回答
1
投票

Bootstrap 3中有非常相似的功能

<div class="btn-group" data-toggle="buttons">
  <label class="btn btn-primary">
    <input type="radio" name="options" id="option1"> Option 1
  </label>
  <label class="btn btn-primary">
    <input type="radio" name="options" id="option2"> Option 2
  </label>
  <label class="btn btn-primary">
    <input type="radio" name="options" id="option3"> Option 3
  </label>
</div>

此处为示例:http://getbootstrap.com/javascript/#buttons-examples

© www.soinside.com 2019 - 2024. All rights reserved.