HTML <output> Attributes

HTML <output> for Attribute

Perform a calculation and show the result in an <output> element:

<form oninput=”x.value=parseInt(a.value)+parseInt(b.value)”>0
<input type=”range” id=”a” value=”50″>100
+<input type=”number” id=”b” value=”50″>
=<output name=”x” for=”a b”></output>
</form>

Try it Yourself »


Definition and Usage

The for attribute specifies the relationship between the result of the calculation, and the elements used in the calculation.

HTML <output> form Attribute

An <output> element located outside a form (but still a part of the form):

<form action=”/action_page.php” id=”numform”
oninput=”x.value=parseInt(a.value)+parseInt(b.value)”>0
<input type=”range” id=”a” name=”a” value=”50″>100
+<input type=”number” id=”b” name=”b” value=”50″>
<input type=”submit”>
</form><output form=”numform” name=”x” for=”a b”></output>

Try it Yourself »


Definition and Usage

The form attribute specifies one or more forms the <output> element belongs to.

HTML <output> name Attribute

Perform a calculation and show the result in an <output> element:

<form oninput=”x.value=parseInt(a.value)+parseInt(b.value)”>0
<input type=”range” id=”a” value=”50″>100
+<input type=”number” id=”b” value=”50″>
=<output name=”x” for=”a b”></output>
</form>

Try it Yourself »


Definition and Usage

The name attribute specifies the name of an <output> element.

The name attribute is used to reference form data after it has been submitted, or to reference the element in a JavaScript.