MDN self-hosted library · e01.org

HTMLOutputElement: htmlFor property

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

js
const outputElem = document.getElementById("result");
for (const id of outputElem.htmlFor) {
  const elem = document.getElementById(id);
  elem.style.outline = "2px solid red";
}