content logo

Learn HTML:

Html output tag

The <output> element represents the result of a calculation. Typically this element defines a region that will be used to display text output from some calculation that is usually performed by a client-side script (usually JavaScript).

The following table summarizes the usages context and the version history of this tag.

 

Syntax

<form oninput="result.value=parseInt(a.value)+parseInt(b.value)">
    <input type="range" id="a" value="50"> +
    <input type="number" id="b" value="100"> =
    <output name="result" for="a b"></output>
</form>

Tag-Specific Attributes

The following table shows the attributes that are specific to the <output> tag.

Attribute Value Description
for element-id Indicating the relationship between the result of the calculation and the elements contributed input values to this calculation. The value of this attribute can be a list of IDs of other elements.
form form-id Specifies the form element that this element is associated with.
name name Specifies name of the element.
#

HTML Output Example

#

HTML Output Code

#

HTML Output Tutorial