| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/output | [Back] [Original] |
Get to know MDN better
<output> HTML output elementThis feature is well established and works across many devices and browser versions. Its been available across browsers since October 2018.
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.
This element includes the global attributes.
forA space-separated list of other elements' ids, indicating that those elements contributed input values to (or otherwise affected) the calculation.
formThe <form> element to associate the output with (its form owner). The value of this attribute must be the id of a <form> in the same document. (If this attribute is not set, the <output> is associated with its ancestor <form> element, if any.)
This attribute lets you associate <output> elements to <form>s anywhere in the document, not just inside a <form>. It can also override an ancestor <form> element. The <output> element's name and content are not submitted when the form is submitted.
nameThe element's name. Used in the form.elements API.
The <output> value, name, and contents are NOT submitted during form submission.
Many browsers implement this element as an aria-live region. Assistive technology will thereby announce the results of UI interactions posted inside it without requiring that focus is switched away from the controls that produce those results.
Live-region updates are generally announced as plain text, so links, buttons, and other semantics nested inside <output> may not be conveyed in the announcement.
In the following example, we provide 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.
<input type="range" id="b" name="b" value="50" /> +
<input type="number" id="a" name="a" value="10" /> =
<output id="result" for="a b">60</output>
const a = document.getElementById("a");
const b = document.getElementById("b");
const result = document.getElementById("result");
function updateResult() {
const aValue = a.valueAsNumber;
const bValue = b.valueAsNumber;
result.value = aValue + bValue;
}
a.addEventListener("input", updateResult);
b.addEventListener("input", updateResult);
updateResult();
| 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. |
| Implicit ARIA role | status |
| Permitted ARIA roles | Any |
| DOM interface | HTMLOutputElement |
| Specification |
|---|
| HTML # the-output-element |
This page was last modified on Oct 14, 2026 by MDN contributors.
<a><abbr><acronym><address><area><article><aside><audio><b><base><bdi><bdo><big><blockquote><body><br><button><canvas><caption><center><cite><code><col><colgroup><data><datalist><dd><del><details><dfn><dialog><dir><div><dl><dt><em><embed><fencedframe><fieldset><figcaption><figure><font><footer><form><frame><frameset><geolocation><h1><h6><head><header><hgroup><hr><html><i><iframe><img><input><ins><kbd><label><legend><li><link><main><map><mark><marquee><menu><meta><meter><nav><nobr><noembed><noframes><noscript><object><ol><optgroup><option><output><p><param><picture><plaintext><pre><progress><q><rb><rp><rt><rtc><ruby><s><samp><script><search><section><select><selectedcontent><slot><small><source><span><strike><strong><style><sub><summary><sup><table><tbody><td><template><textarea><tfoot><th><thead><time><title><tr><track><tt><u><ul><var><video><wbr><xmp>accesskeyanchorautocapitalizeautocorrectautofocusclasscontainertimingcontainertimingignorecontenteditabledata-*dirdraggableenterkeyhintexportpartsheadingoffsetheadingresethiddenidinertinputmodeisitemiditempropitemrefitemscopeitemtypelangnoncepartpopoverslotspellcheckstyletabindextitletranslatevirtualkeyboardpolicywritingsuggestions<input type><input type="button"><input type="checkbox"><input type="color"><input type="date"><input type="datetime-local"><input type="email"><input type="file"><input type="hidden"><input type="image"><input type="month"><input type="number"><input type="password"><input type="radio"><input type="range"><input type="reset"><input type="search"><input type="submit"><input type="tel"><input type="text"><input type="time"><input type="url"><input type="week"><script type>Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |