Last Updated on April 26, 2023 by Roshan Parihar
HTML output tag is used to specify the result of the calculation.
The output can be a result of the calculation performed by the script or the result of user interaction with the form submission.
- You should also read the HTML Form tag
Syntax
1 |
<output name="" for="" ></output> |
1 2 3 4 5 6 7 8 9 10 |
<p>Below is the result of the calculation of c=a+b. c is the name of output tag, a and b are the id's of input elements with type range and number.</p> Scroll this using your mouse. <form oninput="c.value=parseInt(a.value)+parseInt(b.value)"> <label for="value of a">Value of a is: </label> 0<input type="range" id="a" value="50">100 <label for="value of a">Value of b is: </label> +<input type="number" id="b" value="50"> <label for="output is">output is: </label>=<output name="c" for="a b"></output> </form> < |
Output
Below is the result of the calculation of c=a+b. c is the name of output tag, a and b are the id’s of input elements with type range and number.
Scroll this using your mouse.
List of HTML output tag attributes
Sr. No. | Attribute options | Description |
---|---|---|
1 | for | Specify the relationship between the result and inputs. The value of the for attribute can be a list of id’s of input elements. |
2 | form | This specified the form element that the output is related to. The value of this attribute id the id of the form element. |
3 | name | This specifies the name of the output element |