HTMLLabelElement
The HTMLLabelElement interface gives access to properties specific to <label> elements. It inherits methods and properties from the base HTMLElement interface.
Properties
Inherits properties from its parent, HTMLElement.
-
HTMLLabelElement.controlRead only -
Is a
HTMLElementrepresenting the control with which the label is associated. -
HTMLLabelElement.formRead only -
Is a
HTMLFormElementobject representing the form with which the labeled control is associated, ornullif there is no associated control, or if that control isn't associated with a form. In other words, this is just a shortcut forHTMLLabelElement.control.form. HTMLLabelElement.htmlFor-
Is a string containing the ID of the labeled control. This reflects the
forattribute.
Methods
No specific methods; inherits methods from its parent, HTMLElement.
Specifications
| Specification |
|---|
| HTML Standard (HTML) # htmllabelelement |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
HTMLLabelElement |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
control |
6 |
18 |
4 |
No |
≤12.1 |
5.1 |
≤37 |
18 |
4 |
≤12.1 |
5 |
1.0 |
form |
1 |
12 |
1 |
6 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
htmlFor |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
See also
- The HTML element implementing this interface:
<label> <form>HTMLFormElement
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement