Skip to content
Related Articles

Related Articles

HTML | <output> for Attribute

View Discussion
Improve Article
Save Article
  • Last Updated : 06 Jul, 2022
View Discussion
Improve Article
Save Article

The HTML <output> for Attribute is used to specify  the relationship between the result and the calculation.
Syntax: 
 

<output for="element_id">

Attribute Values: It contains a value i.e element_id which specify the separated list of ids of one or more elements that specify the relationship between the result and the calculation.
Example: This Example that illustrates the use of for attribute in Output Element. 
 

html




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML | For Attribute
    </title>
    <style>
        body {
            text-align: center;
        }
         
        h1 {
            color: green;
        }
    </style>
</head>
 
<body>
    <h1>GeeksforGeeks</h1>
    <h2>
      HTML | <output>For Attribute
  </h2>
    <form oninput="sumresult.value = parseInt(A.value)
                + parseInt(B.value) + parseInt(C.value)">
        <input type="number"
               name="A"
               value="50" /> +
 
        <input type="range"
               name="B"
               value="0" /> +
 
        <input type="number"
               name="C"
               value="50" />
        <br /> Submit Result:
        <output name="sumresult"
                for="A B C">
        </output>
        <br>
        <input type="submit">
    </form>
</body>
 
</html>

Output: 
 

Supported Browsers: The browser supported by HTML | <output>for Attribute are listed below: 
 

  • Google Chrome version 10 and above
  • Edge version 18 and above
  • Internet Explorer not supported
  • Firefox version 4 and above
  • Opera 11 and above
  • Safari 7 and above

 


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!