Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Label Object

HTML DOM Label Object


Label Object

The Label object represents an HTML .

Accessing the Label Object

You can use getElementById() to access it

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

Try it

Creating the Label Object

You can use the document.createElement() method to create

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

Try it

Label Object Properties

property Description
control Returns the control that is labeled.
form Returns a reference to the form containing the label.
htmlFor Sets or returns the value of the for attribute of the label.

Standard properties and events

The Label object also supports the standard property and Events.


Related Articles

HTML Tutorial:HTML Forms

HTML Reference Manual:HTML