HTML <output> tag

Updated: 04/26/2017 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 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-hand 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) an <output> element belongs to
name Designates a name for the <output> element

Compatibility

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

Additional form elements

Algorithm, Browser, Compatibility, Nesting, URL