Output
is a new type of form field, which is used for displaying calculated values.
The third field should show the product of the multiplication.
This is how the code looks:<form> <input name="a" type="number" step="any" value="0"> * <input name="b" type="number" step="any" value="0"> = <output name="result" onformchange="value = a.value * b.value">0 </form>
The onformchange
event is a new event which is triggered on all elements in a form,
when any of the input elements changes value. This is useful for tracking dependencies.
An output
field does not support validation and is never submitted. Actually, the only thing that sets it apart from
an ordinary non-form element, is that it recieves the onforminput
and onformchange
events,
and it fires onchange
when the value changes.
Page authors can also chain output-fields together, making more complex calculations. Here is one such chain: