HTML output Tag is used to display the result of user action or the calculation done by the client side script, usually a JavaScript code. HTML output tag is a new HTML5 tag.
Table of Contents
Syntax of HTML output Tag
The Syntax of HTML output Tag is shown below, It has both starting tag and ending tag.
<output>
</output>
Usage of HTML output Tag
HTML output Tag is used to output the result of calculations of JavaScript code. HTML output Tag can also be used to output the result of user action. These user actions are usually related to calculations.
for attribute is used in output tag to define it's relationship with the HTML elements used in calculations.
Example of HTML output Tag
Simple example of HTML output Tag is given below.
<form oninput="a.value=parseInt(x.value)-parseInt(y.value)">
<input type="range" id="x" value="60">
-<input type="number" id="y" value="10">
=<output name="a" for="x y"></output>
</form>
In above example we have used output tag to display the result of calculation of two input elements.
Output
Output of above code is shown below.
Browser Support for HTML output Tag
HTML output Tag is supported by latest versions of all major browsers which include Chrome (10.0 and above), Opera (11.0 and above), Firefox (4.0 and above), Edge (13.0 and above) and Safari (5.1 and above).
Global Attributes Support in HTML output Tag
The HTML output Tag supports all Global Attributes.
Event Attributes Support in HTML output Tag
The HTML output Tag supports all Event Attributes.
HTML output Tag Video
Watch our video on HTML output Tag.