HTML output - how to use <output> tag

The HTML <output> tag is used to disdplay the result of a calculation .

Attributes

The output tag supports the global and event attributes.

for
Defines the relation between this <output> tag and other tags (list of ids) within the page
form
Defines one or more form ids this <output> tag is part of
name
Defines the name of the <output> tag

Examples:

<form oninput="ans.value=parseInt(t1.value)+parseInt(t2.value)"> <input type="number" name="t1" value="10" /> + <input type="number" name="t2" value="20" /> = <output name="ans">30</output> </form>

Related HTML tags:

  • <input> - used to allow users to input data