Web/API/HTMLLabelElement/htmlFor

From Get docs


The HTMLLabelElement.htmlFor property reflects the value of the for content property. That means that this script-accessible property is used to set and read the value of the content property for, which is the ID of the label's associated control element.

Syntax

controlId = HTMLLabelElement.htmlFor

HTMLLabelElement.htmlFor = newId

Value

A DOMString which contains the ID string of the element which is associated with the control.

If this property has a value, the HTMLLabelElement.control property must refer to the same control.


Specifications

Specification Status Comment
HTML Living StandardThe definition of 'htmlFor' in that specification. Living Standard Initial definition

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
htmlFor Chrome

Full support Yes

Edge

Full support 12

Firefox

Full support 1

IE

Full support Yes

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 4

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung Internet Android

Full support Yes

Legend

Full support  
Full support


See also