Label Object
The Label object represents an HTML <label> element.
Access a Label Object
You can access a <label> element by using getElementById():
Create a Label Object
You can create a <label> element by using the document.createElement() method:
Label Object Properties
Property | Description |
---|---|
control | Returns the labeled control |
form | Returns a reference to the form that contains the label |
htmlFor | Sets or returns the value of the for attribute of a label |
Standard Properties and Events
The Label object also supports the standard properties and events.
Related Pages
HTML tutorial: HTML Forms
HTML reference: HTML <label> tag