Output

Table of contents

  1. 1. Summary
  2. 2. Attributes
    1. 2.1. DOM Interface
    2. 2.2. Example
    3. 2.3. Compatibility
  3. 3. See also
Table of contents
  1. 1. Summary
  2. 2. Attributes
    1. 2.1. DOM Interface
    2. 2.2. Example
    3. 2.3. Compatibility
  3. 3. See also

Introduced in HTML 5

Summary

The output (<output>) element represents the result of a calculation.

Content categories Flow content, phrasing content, listed, labelable, resettable form-associated element.
Permitted content Phrasing content.
Tag omission Must have both a start tag and an end tag.
Normative document HTML5, section 4.10.15

Attributes

Like all other HTML elements, this element supports the global attributes.

for
A list of IDs of other elements, indicating that those elements contributed input values to (or otherwise affected) the calculation.
form
The form element that this element is associated with (its "form owner"). The value of the attribute must be an ID of a form element in the same document. If this attribute is not specified, the output element must be a descendant of a form element. This attribute enables you to place output elements anywhere within a document, not just as descendants of their form elements.
name
The name of the element.

DOM Interface

This element implements the HTMLOutputElement interface.

Example

<form oninput="result.value=parseInt(a.value)+parseInt(b.value)">
0<input type="range" name="b" value="50" />100 +<input type="number" name="a" value="10" /> =
<output name="result"></output>
</form>

Compatibility

  • Desktop
  • Mobile

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 10 4.0 (2.0) -- 11 nightly
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? 4.0 (2.0) ? ? ?

See also

Other form-related elements: <form> , <input> , <button> , <datalist> , <legend> , <label> , <select> , <optgroup> , <option> , <textarea> , <keygen> , <fieldset> , <progress> and <meter> .

Tags (5)

Edit tags

Attachments (0)

 

Attach file