Skip to content
Related Articles

Related Articles

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

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 26 Mar, 2021

The name attribute specifies the name of an <output> element. It is used to reference form data after it has been submitted, or to reference the element in JavaScript. The <output> tag is used to represent the result of a calculation.

The HTML <for> type attribute is used because it specifies the relationship between the result of the calculation and the elements used in the calculation. form is used because it specifies which form the output element it belongs to. name is used because it specifies a name for the output element.


<output name="name">



<!DOCTYPE html>
        <h1>The output element</h1>
        <form oninput="k.value=parseInt(x.value)+parseInt(y.value)">
          <input type="range" id="x" value="20"> + 
          <input type="number" id="y" value="20">
          = <output name="k" for="x y"></output>


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!