MDN self-hosted library · e01.org

HTMLLabelElement: htmlFor property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

html
<label for="username">Enter your username:</label>
<input id="username" name="username" type="text" />
js
document.querySelector("label").htmlFor;
// username