Return the value of the for attribute of a label:
The result of x will be:
The htmlFor property sets or returns the value of the for attribute of a label.
The for attribute specifies which form element a label is bound to.
The form property is supported in all major browsers.
Return the htmlFor property:
Set the htmlFor property:
Value | Description |
---|---|
id | The id of the element the label is bound to |
Return Value: | A String, representing the id of the element the label is bound to |
---|
Change the value of the value attribute of a label:
HTML reference: HTML <label> for attribute