From http://www.w3schools.com (Copyright Refsnes Data)
Defines a label to a control. If you click the text within the label element, it is supposed to toggle the control.
NONE
Note: The "for" attribute binds a label to another element. Set the value of the "for" attribute equal to the value of the "id" attribute of the related element.
| Source | Output |
|---|---|
<p>Try clicking on the text labels:</p> <form name="input" action=""><input type="radio" name="sex" id="male" /> <label for="male">Male</label> <br /> <input type="radio" name="sex" id="female" /> <label for="female">Female</label> </form> |
Try clicking on the text labels: |
| Attribute | Value | Description | 4 | 5 |
|---|---|---|---|---|
| for | id_of_another_field | Defines which form element the label is for. Set to an ID
of a form element. Note: If this attribute is not specified, the label is associated with its contents. |
4 | 5 |
| class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title |
For a full description, go to Standard Attributes in HTML 5.
| onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup, onload, onmessage, onmousedown, onmousemove, onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect, onsubmit, onunload |
For a full description, go to Event Attributes in HTML 5.
Label
How to define a label to a control.
From http://www.w3schools.com (Copyright Refsnes Data)