【发布时间】:2023-02-03 05:51:59
【问题描述】:
<div class="container">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">question</th>
<th scope="col">M</th>
<th scope="col">L</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td><input type="radio" id="1q1m" name="fav_language" value="M"></td>
<td><input type="radio" id="1q1l" name="fav_language" value="L"></td>
</tr>
<tr>
<th scope="row">2</th>
<td>Mark</td>
<td><input type="radio" id="1q2m" name="fav_language2" value="M"></td>
<td><input type="radio" id="1q2l" name="fav_language2" value="L"></td>
</tr>
<tr>
<th scope="row">3</th>
<td>Mark</td>
<td><input type="radio" id="1q3m" name="fav_language3" value="M"></td>
<td><input type="radio" id="1q3l" name="fav_language3" value="L"></td>
</tr>
<tr>
<th scope="row">4</th>
<td>Mark</td>
<td><input type="radio" id="1q4m" name="fav_language4" value="M"></td>
<td><input type="radio" id="1q4l" name="fav_language4" value="L"></td>
</tr>
</tbody>
</table>
在javascript中,如果用户选择更多,我如何确保结果只有一个选择值M选择和一个L选择将被阻止。 enter image description here
所以选择的每个列类型只被选中。
【问题讨论】:
标签: javascript radio-button selection survey