Loading...
HTML <output> Tag

HTML <output> Tag

In this tutorial, we will learn about output tag in HTML with the help of examples.


<output> Tag

Output tag <output> is used to represent the result of a calculation.

Syntax

<output>.........</output>

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Output Tag</title>
  </head>
  <body>
    <form oninput = "sumresult.value = parseInt(z1.value)+parseInt(z2.value)+parseInt(z3.value)">
      <input type = "number" name = "z1" value = "10"/> +
      <input type = "range" name = "z2" value = "5"/> +
      <input type = "number" name = "z3" value = "15"/><br>
      The output is: <output name = "sumresult"></output>
    </form>
  </body>
</html>

Output

+ +
The output is:

Specific Attribute

Attribute Value Description
for for It specifies the list of IDs of other elements
i.e. it indicates the elements who have contributed input value to the calculation.
form form It is used to enable to place output elements anywhere within a document
name name It is the name of the element

Global Attribute

Output Tag support all the global attributes of HTML.


Event Attribute

Output Tag support all the event attributes of HTML.


Next Tutorial

We hope that this tutorial helped you develop better understanding of the concept of <output> tag in HTML.

Keep Learning : )

In the next tutorial, you'll learn about HTML <p> Tag.

- Related Topics