javascript - 如何在表单中创建单选按钮组以允许选择餐厅的吸烟/非吸烟部分?
问题描述
我希望使用引导程序来模拟单选按钮的行为,form-group
因此表单中的一行有几个按钮(例如“btn btn-success”),这些按钮可以“选择”,但只有一个可以是在给定的时刻选择。我想要这样的输出:
但我得到了这个:
我也无法选择吸烟按钮
以下代码是:
<div class="form-group row">
<label for="section" class="col-12 col-md-2">Section</label>
<div class="col-md-10">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-success active">
<input type="radio" name="options" id="option1" autocomplete="off" checked>Non-
Smoking
</label>
<label class="btn btn-danger">
<input type="radio" name="options" id="option2" autocomplete="off">Smoking
</label>
</div>
</div>
</div>
解决方案
试试这个
input[type="radio"] {
visibility:hidden;
}
推荐阅读
- sql - 如何计算特定文本字符串出现的次数并按其他列分组
- javascript - 我如何使用 ngFor 来设计这个(可能是嵌套的)表
- android - 在 Firebase 中使用电话、用户名和密码进行身份验证
- mysql - mysql-slow.log 如何找到具体查询 SELECT /*!40001 SQL_NO_CACHE */ * FROM
- android - 重新加载时的空片段
- java - 集合中 ID 的休眠查询返回太多结果
- kubernetes - 如何更改etcd监听的IP和端口
- apache - .htaccess 中的 301 重定向首先在原始 URL 上给出证书警告
- android - 如何从 Observable 打印排放量
>>? - database - `RefreshDatabase` 删除所有表