【发布时间】:2015-11-22 14:14:13
【问题描述】:
我的代码使用引导插件时遇到问题。 我在以下代码中有一些单选按钮:
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="radio" name="options" id="option1" autocomplete="off" checked> Radio 1 (preselected)
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="option2" autocomplete="off"> Radio 2
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="option3" autocomplete="off"> Radio 3
</label>
</div>
我想放一个按钮来重置选择。我试过重置按钮 (<button type="reset">)、jQuery 命令,但都失败了。
在 Bootstrap API 中我找到了一个解释: http://getbootstrap.com/javascript/#buttons-checkbox-radio
说:
视觉检查状态仅在单击时更新 复选框按钮被更新而不触发按钮上的点击事件 (例如,通过或通过设置选中的属性 输入),您将需要切换输入上的 .active 类 给自己贴上标签。
请有人能帮我找到解决问题的方法吗?
谢谢, 加布里埃尔。
【问题讨论】:
标签: php jquery html css twitter-bootstrap