Introduced in HTML5
The HTML <output> element represents the result of a calculation or user action.
| Content categories | Flow content, phrasing content, listed, labelable, resettable form-associated element, palpable content. |
|---|---|
| Permitted content | Phrasing content. |
| Tag omission | None, both the starting and ending tag are mandatory. |
| Permitted parents | Any element that accepts phrasing content. |
| Permitted ARIA roles | Any |
| DOM interface | HTMLOutputElement |
Attributes
This element includes the global attributes.
for- A list of IDs of other elements, indicating that those elements contributed input values to (or otherwise affected) the calculation.
form- The form element that this element is associated with (its "form owner"). The value of the attribute must be an ID of a form element in the same document. If this attribute is not specified, the output element must be a descendant of a form element. This attribute enables you to place output elements anywhere within a document, not just as descendants of their form elements.
name- The name of the element.
Example
<form oninput="result.value=parseInt(a.value)+parseInt(b.value)">
<input type="range" name="b" value="50" /> +
<input type="number" name="a" value="10" /> =
<output name="result">60</output>
</form>
Specifications
| Specification | Status | Comment |
|---|---|---|
| HTML Living Standard The definition of '<output>' in that specification. |
Living Standard | |
| HTML5 The definition of '<output>' in that specification. |
Recommendation |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
| Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic Support | 10 | (Yes) | 4 | No | 11 | 7 |
for | 10 | (Yes) | 4 | No | 11 | 7 |
| Feature | Android | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
|---|---|---|---|---|---|---|---|
| Basic Support | (Yes) | (Yes) | (Yes) | 4 | No | ? | (Yes) |
for | (Yes) | (Yes) | (Yes) | 4 | No | ? | (Yes) |
See also
- Other form-related elements:
<form>,<input>,<button>,<datalist>,<legend>,<label>,<select>,<optgroup>,<option>,<textarea>,<keygen>,<fieldset>,<progress>and<meter>.
Document Tags and Contributors
Tags:
Contributors to this page:
teoli,
sideshowbarker,
libbymc,
Lemondoge,
Sebastianz,
claudepache,
jwmcpeak,
sebaest,
Tyriar,
kscarfone,
MTonly,
Sheppy,
parthiv,
medicdude,
ethertank,
msrishikesh,
ebidel,
cers,
fscholz,
McGurk,
osdm,
jswisher,
Crash
Last updated by:
teoli,

