HTML DOM Label Object


Label Object

The Label object represents an HTML <label> element.

Access a Label Object

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

Example

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

Create a Label Object

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

Example

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

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


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.