编辑*以下答案解决了问题,如果有人有同样的问题 .
单选按钮的小问题我有三条线,每条线有3个单选按钮,我希望用户能够检查前两行的任何单选按钮,但只能在每一行上选择一个选项:
例如
用户只能从“keystage1yr1”中选择一个选项,并且只能从“keystage1yr2”中选择一个选项 . 这一切都很好,因为它们具有相同的“名称”,因此通过defualt,用户只能为每一行选择一个 .
我试过了:
Deselect Radio Button if another one is selected
How do I deselect a whole group of radio buttons when a user clicks on some other button?
但要知道运气,虽然他们可能会帮助其他人 .
<input class="radio" type="radio" name="keystage1yr1" value="Paper" /> <span>£25</span>
<input class="radio" type="radio" name="keystage1yr1" value="CD" /> <span>£25 excl VAT</span>
<input class="radio" type="radio" name="keystage1yr1" value="Paper & CD" /> <span>£40 excl VAT</span>
<input class="radio" type="radio" name="keystage1yr2" value="Paper" /> <span>£25</span>
<input class="radio" type="radio" name="keystage1yr2" value="CD" /> <span>£25 excl VAT</span>
<input class="radio" type="radio" name="keystage1yr2" value="Paper & CD" /> <span>£40 excl VAT</span>
<input class="radio" type="radio" name="keystage1save" value="Paper" /> <span>£47.50</span>
<input class="radio" type="radio" name="keystage1save" value="CD" /> <span>£47.50 excl VAT</span>
<input class="radio" type="radio" name="keystage1save" value="Paper & CD" /> <span>£75 excl VAT</span>
提前致谢 .
1 回答
这里有一些Javascript可以帮助你:
这个工作的一个例子:http://jsfiddle.net/CUTnY/