HTML <output> formAttribute

HTML output 标签参考手册HTML <output> Tag

Examples

An <output> element located outside the form (but still part of the form):

<form action="demo_form.html" id="numform"
oninput="x.value=parseInt(a.value)+parseInt(b.value)">0
<input type="range" id="a" name="a" value="50">100
+<input type="number" id="b" name="b" value="50">
<br><br>
<input type="submit">
</form>

<output form="numform" name="x" for="a b"></output>

Try it yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Almost all mainstream browsers do not support the form attribute.


Definition and Usage

The form attribute specifies one or more forms to which the <output> element belongs.


Differences between HTML 4.01 and HTML5

The <output> tag is new in HTML5.


Syntax

<output form="form_id">

Attribute Values

Value Description
form_id Specifies a space-separated list of id(s) of one or more forms to which the <output> element belongs.


HTML output 标签参考手册HTML <output> Tag Other Extensions