output

<output> element – used to display results of a calculation. For example, one could use a little JavaScript to perform a calculation based on form input fields.

Usage: this element is used to display the results of a calculation. One can include the name, form, and for attributes for this element.

Permitted Content: any element containing phrasing elements.

Tag omission: both start and end tag must be present for <output> element.

Example code:

<p>First Value: <input type=”number” id=”val1″ /></p>
<p>Second Value:<input type=”number” id=”val2″ /></p>
<p><input type=”button” onclick=”calculate();” value=”Add First and Second Values” />
<p>Result of addition: <output id=”result”></output></p>

Example page (opens in a new tab/ window – view source code): http://learning-html5.info/examples/ExampleOutput.html

Default display properties: display: inline.

Common Attributes: typical global attributes along with name, form, for.

Permitted Parent Elements: any element which can contain phrasing or flow elements.

References: http://dev.w3.org/html5/markup/output.html

Leave a Reply

Your email address will not be published. Required fields are marked *