VOOZH about

URL: https://www.geeksforgeeks.org/html/html-output-name-attribute/

⇱ HTML <output> name Attribute - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML <output> name Attribute

Last Updated : 11 Jul, 2025

HTML <output> name attribute specifies the name of the element, which is submitted with the form data when the form is submitted. It's useful for associating the output with a form element.

HTML <output> name Attribute Syntax: 

<output name="text"> 

HTML <output> name Attribute Values:

It contains the value i.e. name which specifies the name for the <Output> element. 

HTML <output> name Attribute Example: 

In this example, we parse input values, calculate the sum, and display the result in real-time using the output element.

Output:

👁 HTML output name attribute example output

HTML <output> name Attribute Example Explanation:

  • In the above-example ontains a form element with three input fields: two number inputs and one range input.
  • The oninput attribute in the form tag calculates the sum of the values entered in the input fields and assigns it to the output element with the name sumresult.
  • The <output> element displays the result of the calculation dynamically as the inputs change.
  • Users can interact with the inputs to see the real-time sum displayed in the output element.

HTML <output> name Attribute Use Cases

1. How to specify a name for the output element in HTML?

To Specify a name for the output element in HTML using the name attribute within the <output> tag.

2.How to define one or more forms the output element belongs to ?

Here we use the form attribute in the <output> tag to specify one or more forms the output element belongs to.

HTML <output> name Attribute Supported Browsers:

  • Google Chrome 10.0
  • Firefox 4.0
  • Edge 18.0
  • Opera 11.0
  • Apple Safari 7.0
Comment
Article Tags: