Button 如何使按钮组像单选按钮组一样工作?
我使用的是Bootstrap3,我想让两个按钮作为单选按钮工作,但我不知道怎么做。这是我的密码Button 如何使按钮组像单选按钮组一样工作?,button,twitter-bootstrap-3,radio-group,buttongroup,Button,Twitter Bootstrap 3,Radio Group,Buttongroup,我使用的是Bootstrap3,我想让两个按钮作为单选按钮工作,但我不知道怎么做。这是我的密码 <div class="btn-group" > <div class="btn-group"> <button type="button" class="btn btn-default"> PERSONAL </button> </div> <div cl
<div class="btn-group" >
<div class="btn-group">
<button type="button" class="btn btn-default">
PERSONAL
</button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-default">
COMPANY
</button>
</div>
</div>
个人的
公司
当我选择PERSONAL时,另一个将被取消选择(应该如此),但问题是:
- 当表单启动时,它们都不处于活动状态
- 我可以取消选择窗体外的两个单击
<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>
$('.btn').button()