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>