0
<input type="radio" name="allotdeallot" value="Allotment" />Allotment
<input type="radio" name="allotdeallot" value="De-Allotment" />De-Allotment
我有两个单选按钮,我想检查或取消选中标签单击。选中或取消选中单选按钮时,我点击文字
<input type="radio" name="allotdeallot" value="Allotment" />Allotment
<input type="radio" name="allotdeallot" value="De-Allotment" />De-Allotment
我有两个单选按钮,我想检查或取消选中标签单击。选中或取消选中单选按钮时,我点击文字
按照HTML标准,每个表单元素必须有label
重视它。您希望隐藏标签的文字,您可以使用position:absolute
至label
来隐藏lable
的文字。因此,这里是你的答案,
<input id="allotment" type="radio" name="allotdeallot" value="Allotment" /><label for="allotment">Allotment</label>
<input id="de-allotment" type="radio" name="allotdeallot" value="De-Allotment" /><label for="de-allotment">De-Allotment</label>
的id of the input field
必须用相同for attribute of the label
。
使用<label>
标签和id
属性添加到radio
按钮:
<input type="radio" name="allotdeallot" id="allotment" value="Allotment" /><label for="allotment">Allotment</label>
<input type="radio" name="allotdeallot" id="deallotment" value="De-Allotment" /><label for="deallotment">De-Allotment</label>