HTML DOM Label Object

Label object

The Label object represents the HTML <label> element.

Access Label object

You can access the <label> element by using getElementById():

var x = document.getElementById("myLabel");

Try it yourself

Create Label object

You can create a <label> element by using the document.createElement() method:

var x = document.createElement("LABEL");

Try it yourself

Label object properties

Properties Description
control Return the marked control.
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

Label Object Supports StandardsPropertiesAndEvents.

Related Pages

HTML Tutorial:HTML Forms

HTML Reference Manual:HTML <label> Tag