What Is The HTML <output> Tag?

What Is The HTML Mark Tag

Date First Published: 23rd January 2024

Topic: Web Design & Development

Subtopic: Web Development

Article Type: Computer Terms & Definitions

Difficulty: Medium

Difficulty Level: 5/10

Learn about what the HTML <output> tag is in this article.

In HTML, the output tag is used to display the output of a calculation. Even though a fixed calculation can be written in plain text, it is harder to display more complex calculations. The output tag is designed for complex calculations that are performed by the user or a script. The actual calculation is usually performed using JavaScript.

The output tag is a new tag introduced in HTML 5. It is supported by all major web browsers and was designed to provide an efficient and semantic way to show the outcome of calculations, enhancing the overall user experience. The results of calculations can be instantly displayed without the need for additional JavaScript.

Example Of The Output Tag

Below is an example of the output tag.

<form oninput="x.value=parseInt(a.value)+parseInt(b.value)"> <input type="range" id="a" value="50"> +<input type="number" id="b" value="25"> =<output name="x" for="a b"></output> </form>
+ =

Attributes

The output tag contains the following unique attributes:

Attribute Description
For Specifies the relationship between the calculation results and the elements used in the calculation.
Form Specifies the forms containing the output element.
Name Specifies a name for the output element.


Feedback

  • Is there anything that you disagree with on this page?
  • Are there any spelling, grammatical, or punctuation errors on this page?
  • Are there any broken links or design errors on this page?

If so, it is important that you tell me as soon as possible on this page.


Comments