HTML <label> สำหรับแอตทริบิวต์
ตัวอย่าง
ปุ่มตัวเลือกสามปุ่มพร้อมป้ายกำกับ:
<form action="/action_page.php">
<input type="radio" id="html" name="fav_language" value="HTML">
<label for="html">HTML</label><br>
<input type="radio" id="css"
name="fav_language" value="CSS">
<label for="css">CSS</label><br>
<input type="radio" id="javascript" name="fav_language" value="JavaScript">
<label for="javascript">JavaScript</label><br><br>
<input
type="submit" value="Submit">
</form>
ความหมายและการใช้งาน
แอตทริบิวต์for
ระบุองค์ประกอบแบบฟอร์มที่ป้ายกำกับถูกผูกไว้
รองรับเบราว์เซอร์
Attribute | |||||
---|---|---|---|---|---|
for | Yes | Yes | Yes | Yes | Yes |
ไวยากรณ์
<label for="element_id">
ค่าแอตทริบิวต์
Value | Description |
---|---|
element_id | The id of the element the label is bound to |
❮ แท็ก HTML <label>