The HTML Output element (<output>) is a container element into which a site or app can inject the results of a calculation or the outcome of a 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 space-separated list of other elements’
ids, 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
idof a form element in the same document. This attribute is not needed if the output element is a descendant of a form element or not associated with a form element. name- The name of the element, exposed in the
HTMLFormElementAPI.
Example
This form provides a slider whose value can range between 0 and 100. and an <input> element into which you can enter a second number. The two numbers are added together and the result is displayed in the <output> element each time the value of any of the controls changes.
<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.
Update compatibility data on GitHub
| Desktop | Mobile | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
output | Chrome Full support 10 | Edge Full support Yes | Firefox Full support 4 | IE No support No | Opera Full support 11 | Safari Full support 7 | WebView Android Full support Yes | Chrome Android Full support Yes | Edge Mobile Full support Yes | Firefox Android Full support 4 | Opera Android ? | Safari iOS Full support Yes | Samsung Internet Android Full support Yes |
for | Chrome Full support 10 | Edge Full support Yes | Firefox Full support 4 | IE No support No | Opera Full support 11 | Safari Full support 7 | WebView Android Full support Yes | Chrome Android Full support Yes | Edge Mobile Full support Yes | Firefox Android Full support 4 | Opera Android ? | Safari iOS Full support Yes | Samsung Internet Android Full support Yes |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
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:
mdnwebdocs-bot,
geraldfullam,
ExE-Boss,
mfuji09,
Tigt,
doesntgolf,
yuheiy,
frigus02,
Sheppy,
teoli,
sideshowbarker,
libbymc,
Lemondoge,
Sebastianz,
claudepache,
jwmcpeak,
sebaest,
Tyriar,
kscarfone,
MTonly,
parthiv,
medicdude,
ethertank,
msrishikesh,
ebidel,
cers,
fscholz,
McGurk,
osdm,
jswisher,
Crash
Last updated by:
mdnwebdocs-bot,

