Twitter bootstrap 引导4堆叠无线电btn组

Twitter bootstrap 引导4堆叠无线电btn组,twitter-bootstrap,Twitter Bootstrap,因此,我有一组btn单选按钮,我想相应地堆叠它们。 我只是不能让它工作,除非当我删除btn组,但然后单选按钮当然不知道哪些是检查,只是停止工作 <div class="container"> <div class="row"> <div class="btn-group" role="group" data-toggle="buttons"> <div class="col-lg-4">

因此,我有一组btn单选按钮,我想相应地堆叠它们。 我只是不能让它工作,除非当我删除btn组,但然后单选按钮当然不知道哪些是检查,只是停止工作

<div class="container">
    <div class="row">
        <div class="btn-group" role="group" data-toggle="buttons">
            <div class="col-lg-4">
                <label class="btn btn-primary active"><input hidden="true" type="radio" name="options" id="option1" autocomplete="off" checked> Radio 1</label>
            </div>
            <div class="col-lg-4">
                <label class="btn btn-primary"><input hidden="true"  type="radio" name="options" id="option2" autocomplete="off"> Radio 2</label>
            </div>
            <div class="col-lg-4">
                <label class="btn btn-primary"><input hidden="true" type="radio" name="options" id="option3" autocomplete="off"> Radio 3</label>
            </div>
        </div>
    </div>
</div>

第一台
第二台
第三台

您只需添加以下脚本即可实现:

$("input[type=radio]").on("change",function(){
    $('input:checked').parent().addClass("active"); // Change active with your own class name
});

那你到底想要什么?选中单选按钮的值或选中单选按钮上的活动类?@AbhishekKumbhani我需要活动类class@n-wasserkampf实际上是自动引导添加一个活动类。这是你的电话号码。确保已正确添加bootstrap.css、bootstrap.js和jquery.js文件。@AbhishekKumbhani谢谢,我会调查的。谢谢!我修改了一点,以适应我的需要,非常感谢!