Form Element: Output

Ever use one of those mortgage calculators online? They might have used the <output> element, which represents the result of a calculation (like one performed by a script). This form document performs a calculation and shows the result in an <output> element:

HTML file: Displayed by browser:
<form onsubmit="return false" oninput="o.value = parseInt(a.value) + parseInt(b.value)">
  <input name="a" type="number" step="any"> +
  <input name="b" type="number" step="any"> =
  <output name="o"></output>
</form>
+ =

I found many <output> examples were too confusing to understand. Then, FINALLY, I found this simple set up, which helped to comprehend what this tag does! Users choose the numbers to add (inputs A and B) and the form automatically outputs the total. That's simple enough, but I'll probably never use this!

Unfortunately, this tag doesn't seem to work in IE... but it does in Chrome and Firefox.

Back button Table of Contents Next button