HTMLOutputElement: htmlFor property
The htmlFor
property of the HTMLOutputElement
interface is a string containing a space-separated list of other elements' id
s, indicating that those elements contributed input values to (or otherwise affected) the calculation. It reflects the for
attribute of the <output>
element.
Value
A string.
Examples
js
const outputElem = document.getElementById("result");
for (const id of outputElem.htmlFor.split(" ")) {
const elem = document.getElementById(id);
elem.style.outline = "2px solid red";
}