Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

html
communitycreator

What is <output> element in HTML?

Arslan Bajwa

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

In HTML, the <output> element is used to display the result of a calculation. It is a container into which an app or website can inject results or outcomes of an action performed by a user.

Syntax

<output for="" form="" name=""> output content </output>

where:

  • for: It takes element_id as value.
  • form: It takes form_id as value. It specifies the <form> element with which the <output> element is associated. The associated <form> should be in the same document.
  • name: It takes name as value. It specifies the name of the <output> element.
  • The value, contents, and name of the <output> element are not submitted during the form submission.
  • If the form attribute is not set, the <output> is associated with its ancestor element.

Example

The following code demonstrates the usage of the <output> element in HTML. The content we want to be displayed as a result of a calculation is written within the opening and closing tags (<output> and </output>).

  • HTML

RELATED TAGS

html
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring