Skip to content

<output> - The Output Element

Form Control HTML5

The output element represents the result of a calculation or user action. It’s semantically meaningful for displaying values computed from form inputs or other interactions.

Result
<output name="result" for="input1 input2">
Default value
</output>

The for attribute lists the IDs of inputs that affect this output’s value.

AttributeDescriptionExample
forSpace-separated list of input IDsfor="price quantity"
nameName for form submissionname="total"
formAssociates with form by IDform="myForm"
Result
Result
Result
Result
Result
Result
Result
Result
Result
Result
Result
<!-- Semantically represents a calculation result -->
<form oninput="total.value = a.value * b.value">
<input type="number" id="a" value="5">
×
<input type="number" id="b" value="10">
=
<output name="total" for="a b">50</output>
</form>

Use when: Value is calculated from inputs, result relates to form data, or semantic meaning is important.

Always use the for attribute to link output with related inputs:

Result
Result
Result
<output name="total" for="price quantity">$100.00</output>
Result
Result
BrowserVersionNotes
Chrome10+Full support
Firefox4+Full support
Safari7+Full support
Edge13+Full support
IENot supported