HTML <output> tag

Updated: 11/13/2018 by Computer Hope

HTML output tagWhen writing in HTML, the <output> tag is an inline element used to represent the result of a user's action or a calculation. A good example of an output is a computation performed by a script. The following sections contain information about this tag, including an example of it in use, as well as related attributes and browser compatibility.

Note: The <output> tag belongs to a group of tags called form elements.

Example of <output> code

<form oninput="x.value=parseInt(f.value)+parseInt(s.value)">0
<input type="range" id="f" value="10">100
+<input type="number" id="s" value="25">
=<output name="x" for="f s"></output>
</form>

Example result

0 100 + =

Tip: You may adjust the value inside the box by clicking either the up or down arrows on the right side.

Attributes

Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. The following table shows all of the current unique HTML attributes for the <output> tag, as well as a description of each.

Attribute Description
for Designates the relationship between the calculation results, and the elements used in obtaining that result.
form Designates the form(s) containing the <output> element.
name Designates a name for the <output> element.

Compatibility

Edge Internet Explorer Firefox Safari Opera Chrome
All versions Not supported 4.0+ 7.0+ 11.0+ 10.0+

Additional form elements

Algorithm, Browser, Compatibility, Nesting, URL, Web design terms