Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML DOM Label object


May 06, 2021 JavaScript with HTML DOM Reference book


Table of contents


HTML DOM Label object


Label object

The Label object represents an HTML- and keygen-and-gt;

Access the Label object

You can use getElementById() to access the elements of the .lt;label:

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

Create a Label object

You can use the document.createElement() method to create the element of the slt;label:

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

Label object properties

Attributes describe
control Returns the control of the label.
form Returns a reference to a form containing Label.
htmlFor Set or returns the value of the for attribute of the Lable.

Standard properties and events

Label objects also support standard properties and events.


Related articles

HTML tutorial: HTML forms

HTML Reference Manual: HTML slt;label.gt; Tags