HTML - <output> Tag


Advertisements


Description

The HTML <output> tag specifies the result of a calculation.

Example

Live Demo
<!DOCTYPE html>
<html>

   <head>
      <title>HTML Output Tag</title>
   </head>

   <body>
      <form oninput = "sumresult.value = parseInt(z1.value)+parseInt(z2.value)+parseInt(z3.value)">
         <input type = "range" name = "z1" value = "0" /> +
         <input type = "number" name = "z2" value = "20" /> +
         <input type = "number" name = "z3" value = "40" /><br />
         The output is: <output name = "sumresult"></output>
      </form>
   </body>

</html>

This will produce the following result −

Global Attributes

This tag supports all the global attributes described in − HTML Attribute Reference

Specific Attributes

The HTML <output> tag also supports the following additional attributes −

Attribute Value Description
forhtml-5 for List of IDs of other elements, i.e it indicates the elements who have contributed input value to the calculation.
formhtml-5 form Enables to place output elements anywhere within a document.
namehtml-5 name It is the name of the element.

Event Attributes

This tag supports all the event attributes described in HTML Events Reference

Browser Support

Chrome Firefox IE Opera Safari Android
Yes Yes No Yes Yes No

html_tags_reference.htm

Advertisements
E-Books Store