You are here: Reference > HTML > attributes > for (label)

for attribute (label)

Browser support:
Sets the identifier of the object to which the label element is attached. The label element can be used to associate information with controls.
JavaScript page for this attribute: htmlFor. You can find other example(s) there.

Possible values:

String that sets the identifier of the associated object.
Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the for attribute:
    <input type="checkbox" id="chBox" />
    <label for="chBox">You can change the checkbox state by clicking on this text</label>
Did you find this example helpful? yes no

Supported by tags:

External links:

User Contributed Comments

Post Content

Post Content