Categories
HTML Web development

HTML output tag

HTML Output tag

The HTML <output> tag is used to represent the result of a calculation performed by a script or user’s interaction with an HTML form element.

Example:

<!DOCTYPE html>
<html>
<body>

<form oninput="calc.value=parseInt(first.value)+parseInt(second.value)">
<input type="range" id="first" value="50">
+<input type="number" id="second" value="20">
=<output name="calc" for="first second"></output>
</form>

</body>
</html>

Output:

+ =

for (value- element_id) – defines the relationship between the result of the calculation, and the elements used in the calculation.

form (value- form_id) – defines which form the output element belongs to

name (value- name) – defines a name for the output element.

Enjoy coding!