Tim*_*Tim 0 html javascript forms
我有一个HTML表单,我把它放在一起......
有一个问题"你能参加吗?" 带有"是"和"否"复选框.
很明显,提交表单的人是否参加,所以我希望表单只允许选择一个复选框.
这是HTML:
<p>Can you attend?</p>
<label>
<input type="checkbox" name="attendance" value="checkbox" id="Yes" />
Yes</label>
<label>
<input type="checkbox" name="attendance" value="checkbox" id="No" />
No</label>
Run Code Online (Sandbox Code Playgroud)
我的代码需要什么?我猜一些JavaScript?
谢谢
因此收音机诞生了:-)
<p>Can you attend?</p>
<label>
<input type="radio" name="attendance" value="checkbox" id="Yes" />
Yes</label>
<label>
<input type="radio" name="attendance" value="checkbox" id="No" />
No</label>
Run Code Online (Sandbox Code Playgroud)