Advanced Forms
Output Calculation
A small order form uses numeric inputs and output so the calculated total has explicit form semantics.
Program
output represents a calculated value. The for attribute lists which controls take part in the calculation.
output_calculation.html
<form oninput="total.value = Number(qty.value) * Number(price.value)">
<input id="qty" name="qty" type="number" value="3">
<input id="price" name="price" type="number" value="12">
<output name="total" for="qty price">36</output>
</form>
output
output represents the result of a calculation.
for attribute
The output for attribute identifies the controls used in the result.