Name
Label — a <label> for a form control
Inherits from
Node, Element
Synopsis
A Label object represents a <label>
element in an HTML
form.
Properties
readonly Element
control
The FormControl that this Label is associated with. If
htmlFor
is specified, this property is the control specified by that property. Otherwise, this property is the first FormControl child of the<label>
.readonly Form
form
This property is a reference to the Form element that contains this label. Or, if the HTML
form
attribute is set, the Form element identified by that ID.string
htmlFor
This property mirrors the HTML
for
attribute. Sincefor
is a reserved word in JavaScript, the name of this property is prefixed with “html” to create a legal identifier. If set, this property should specify the ID of the FormControl that this label is associated with. (It is usually simpler, however, to simply make that FormControl be a descendant of this Label.)
Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.