View video tutorial

HTML <output> Tag

HTML

The <output> tag is used to represent the result.

HTML <output> Tag


An <output> element is a container in which a site or app can insert the results of a calculation.

The <output> element can also be used to show the output of a calculation as a result of user interaction.

Element Attributes

Attribute Value Description
for element_id This specifies the elements that contribute to the calculation.
form form_id This specifies which form the output element belongs to.
name name This specifies the name of the output element.

Global attributes

Global attributes may be applied on all elements, although some elements may have no effect on them.

<accesskey>, <class>, <contenteditable>, <contextmenu>, <data-*>, <dir>, <draggable>, <dropzone>, <hidden>, <id>, <lang>, <spellcheck>, <style>, <tabindex>, <title>, <translate>.

Learning with HTML Editor "Try it Now"

You can edit the HTML code and view the result using online editor.

Example

  <form oninput="r.value=parseInt(a.value)+parseInt(b.value)">
    Number1:<input type="number" id="a" value="1"><br><br>
    Number2:<input type="number" id="b" value="1"><br><br>
    Summation:<output name="r" for="a b"></output>
  </form>
Try it Now »

Click on the "Try it Now" button to see how it works.