HTML Dog
Skip to navigation

HTML Tag: output

A form control that represents the result of a calculation.

Any textual content in an output element will define its initial value. JavaScript is typically used to adjust the value as the user makes adjustments to associated form controls.

Optional Attributes

Attribute Description Possible values
name Name of the form control, to be paired with its value when the form is submitted. Text (no spaces).
for States which form controls are used in the calculation resulting in the value of the output A space-separated list of form control id attributes.
form Explicitly associates the control to a form element, which it may or may not be nested within. If absent, the control will be associated to its form ancestor. Text matching the value of a form element’s id attribute.
Global attributes

Example


<form>
    <input name="this" id="this" type="number" value="46"> +
    <input name="that" id="that" type="number" value="44"> =
    <output name="result" for="this that">90</output>
</form>