在 Bootstrap 5 中使用多个单选组进行单独选择

问题描述

我有三个无线电组,有两个选项。在每一组中,可以选择一个选项。但它不起作用。它被缠住了。

预期行为是可以选择三个答案。

<div class="text-center">
  <label>Question-1</label>
  <div class="btn-group" role="group" aria-label="Basic radio toggle button group 1">
    <input type="radio" class="btn-check" name="Answer1" id="btnradio1" value="true" autocomplete="off">
    <label class="btn btn-outline-primary" for="btnradio1">Yes</label>
  
    <input type="radio" class="btn-check" name="Answer1" id="btnradio2" value="false" autocomplete="off">
    <label class="btn btn-outline-primary" for="btnradio2">No</label>
  </div>
</div>

<br>
<div class="text-center">
  <label>Question-2</label>
  <div class="btn-group" role="group" aria-label="Basic radio toggle button group 2">
    <input type="radio" class="btn-check" name="Answer2" id="btnradio3" value="true" autocomplete="off">
    <label class="btn btn-outline-primary" for="btnradio3">Yes</label>
  
    <input type="radio" class="btn-check" name="Answer2" id="btnradio4" value="false" autocomplete="off">
    <label class="btn btn-outline-primary" for="btnradio4">No</label>
  </div>
</div>

<br>
<div class="text-center">
  <label>Question-3</label>
  <div class="btn-group" role="group" aria-label="Basic radio toggle button group 3">
    <input type="radio" class="btn-check" name="Answer3" id="btnradio5" value="true" autocomplete="off">
    <label class="btn btn-outline-primary" for="btnradio5">Yes</label>
  
    <input type="radio" class="btn-check" name="Answer3" id="btnradio6" value="false" autocomplete="off">
    <label class="btn btn-outline-primary" for="btnradio6">No</label>
  </div>
</div>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)