A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/html/how-to-specify-a-name-for-the-output-element-in-html/ below:

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

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

Last Updated : 23 Jul, 2025

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.

Syntax:

<output name="name">

Example: In this example, we will specify a name for the output element.

HTML
<!DOCTYPE html>
<html>
  
<body>
    <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>
    </form>
</body>

</html>

Output:



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4