HTML DOM LabelObject
Label Object
The Label object represents an HTML <keygen> element.
Access a Label Object
You can use getElementById() to access a <label> element:
var
x = document.getElementById("myLabel");
Try it Yourself
Create a Label Object
You can use the document.createElement() method to create a <label> element:
var x = document.createElement("LABEL");
Try it Yourself
Label Object Properties
| Property | Description |
|---|---|
| control | Returns the control associated with the label. |
| form | Returns a reference to the form that contains the label. |
| htmlFor | Sets or returns the value of the for attribute of the label. |
Standard Properties and Events
The Label object also supports standardPropertiesandEvents。
Related Articles
HTML Tutorial:HTML Forms
HTML Reference:HTML <label> Tag
Other Extensions