HTML output tag

Html <output> tag provides the output of some calculation. The calculated value may be the result of user action. See the example given below to understand.


<form oninput="op.value = x.valueAsNumber - y.valueAsNumber">
  <input name="x" type="number" >-
  <input name="y" type="number" >=
  <output name="op" for="x y"></output>
Try </>

Related tags

<input> input tag defines an input field where a user can enter the required information.
<p>The paragraph line breaks at <br> element.</p>
<form> form tag defines a form to collect information.
<p>The paragraph line breaks at <br> element.</p>

Tag omission

Both starting and ending tags are necessary for the output element.

Global Attributes

All the global attributes are applicable on the output element.

Specific Attributes

The specific attributes related to the output element are given below.

for for attribute establishes a relation between input and output. The value of this attribute is the id of input.
<output for="x y"> <input name="x"> <input name="y" > </output>
name the name attribute specifies a unique name for the output element.
<output name="op" for="x y"> </output>

Was this article helpful?




Get the newsletter