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>
- =

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.

Tag Attributes

Attributes that are applicable to <output> tag

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>

the name attribute specifies a unique name for the output element.

<output name="op" for="x y"> </output>

Was this article helpful?