Output — an HTML form <output> element

Inherits from

Node, Element, FormControl


The Output object represents an HTML form <output> element. In browsers that support them, Output objects implement most of the properties of FormControl.


string defaultValue

This property is the initial value of the Output element’s textContent (see Node). When the form is reset, its value is restored to this value. If this property is set and the Output element is currently displaying its previous defaultValue, the new default value will be displayed. Otherwise, the currently displayed value will not be changed.

readonly DOMSettableTokenList htmlFor

The HTML for attribute of an <output> element is a space-separated list of the IDs of elements whose values contributed to the computed content displayed by the <output> element. for is a reserved word in JavaScript, so this corresponding JavaScript property is named htmlFor instead. You can get and set this property as if it was an ordinary string value, or you can use the methods of DOMTokenList to query and set individual element IDs from the list.

Get JavaScript: The Definitive Guide, 6th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.