Use the <output> tag in HTML5 to specify the result of a calculation. The HTML <output> tag also supports the following additional attributes −
Attribute | Value | Description |
---|---|---|
for ![]() | for | List of IDs of other elements, i.e. it indicates the elements who have contributed input value to the calculation. |
form ![]() | form | Enables to place output elements anywhere within a document. |
name ![]() | name | It is the name of the element. |
Example
You can try to run the following code to learn how to implement <output> tag in HTML5 −
<!DOCTYPE html> <html> <head> <title>HTML Output Tag</title> </head> <body> <form oninput = "sumresult.value = parseInt(z1.value)+parseInt(z2.value)+parseInt(z3.value)"> <input type = "range" name = "z1" value = "0" /> + <input type = "number" name = "z2" value = "30" /> + <input type = "number" name = "z3" value = "60" /><br /> The output is: <output name = "sumresult"></output> </form> </body> </html>