HTML DOM Label Object

Label Object

The Label object speaks to a HTML <label> element.

Access a Label Object

You can get to a <label> component by utilizing getElementById():

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

Create a Label Object

You can make a <label> component by utilizing the document.createElement() method:

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

Label Object Properties

Property Description
control Returns the named control
form Returns a reference to the structure that contains the label
htmlFor Sets or returns the estimation of the for trait of a label

Standard Properties and Events

The Label object additionally underpins the standard properties and events.

Related Pages

HTML instructional exercise: HTML Forms

HTML reference: HTML <label> tag