html - Bootstrap btn-group 不会更改单选按钮

标签 html twitter-bootstrap

这是我的标记

      <div class="btn-group" data-toggle="buttons">
    <label class="btn btn-primary">
        <input type="radio" name="account-type" id="optionsRadios1" value="1"> <span class="glyphicon glyphicon-user"></span>
User</label>
    <label class="btn btn-primary active">
        <input type="radio" name="account-type" id="optionsRadios2" value="2" checked> <span class="glyphicon glyphicon-eye-open"></span>
Special user</label>
    <label class="btn btn-primary">
        <input type="radio" name="account-type" id="optionsRadios2" value="3"> <span class="glyphicon glyphicon-home"></span>
Agency</label>
</div>

它呈现一切正常,问题是如果我选择值 3,它不会将第三个单选按钮标记为已选中,或者如果我选择它则不会标记任何其他选项,所以当我提交表单时,它不会无论我选择哪个选项,默认选中的选项都会被提交。

有什么建议吗?

最佳答案

正如有人指出的,您的第三个单选按钮 ID 是错误的。

但这不是问题:

真正的问题是您在 Bootstrap 后加载 jQueryUi(我猜)。这是一个已知的“错误”。只需在 Bootstrap 之前加载 jQueryUi,一切都会正常运行

关于html - Bootstrap btn-group 不会更改单选按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22206303/

相关文章:

html - 导航菜单宽度自动缩短或展开

html - css 背景输入和 firefox

css - HTML5 和 Bootstrap - 两侧留有空格?

javascript - Bootstrap 3.3 - 导航栏无法在移动设备上运行

javascript - 在基于触摸的设备上禁用外部内容的滚动(Twitter Bootstrap 导航栏)

javascript - 在索引 html 顶部弹出登录表单

javascript - 如何使Webview findInPage()在Electron中工作

html - 如何在图像选定区域的文本上添加鼠标?

jquery - 如何从文件夹中删除根目录?

javascript - Bootstrap 模式确认后更改选择列表