Back to Docs

<output>

Description

The <output> HTML element is a container element into which a site or app can inject the results of a calculation or the outcome of a user action. It can be linked to the inputs used in the calculation using the for attribute, which assists accessibility tools in understanding that the output is dependent on those fields.

Code Snippet

<form oninput="result.value=Number(a.value)+Number(b.value)">
    <input type="number" id="a" value="10">
    +
    <input type="number" id="b" value="20">
    =
    <output name="result" for="a b">30</output>
</form>

Static Live Preview

localhost/output-static.html
+ = 30

Interactive Playground

localhost/output-interactive.html