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

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

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?