简体   繁体   English

如何使单选按钮组像一个组一样起作用?

[英]How to make groups of radio buttons act like one group?

I'm using Bootstrap button groups and I need to make two groups of buttons because each group of them closely relate to a single topic. 我正在使用Bootstrap按钮组 ,我需要制作两组按钮,因为它们中的每一组都与一个主题密切相关。 But I want both groups of the buttons to act like they are in the same group. 但是我希望两组按钮都像它们在同一组中一样工作。 How can I do that? 我怎样才能做到这一点?

<div class="btn-toolbar">
    <div class="btn-group" data-toggle="buttons-radio">
        <button class=btn>a</button>
        <button class=btn>b</button>
        <button class=btn>c</button>
    </div>
    <div class="btn-group" data-toggle="buttons-radio">
        <button class=btn>d</button>
        <button class=btn>e</button>
        <button class=btn>f</button>
    </div>
</div>

I have these, but I only want to allow user to select either a, b, c, d, e or f. 我有这些,但我只想允许用户选择a,b,c,d,e或f。

fiddle 小提琴

I have no idea why it works... 我不知道为什么会起作用...

<div class="btn-toolbar" data-toggle="buttons-radio">
    <div class="btn-group">
        <button class=btn>a</button>
        <button class=btn>b</button>
        <button class=btn>c</button>
    </div>
    <div class="btn-group">
        <button class=btn>d</button>
        <button class=btn>e</button>
        <button class=btn>f</button>
   </div>
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM