HTML <output> forAttribute

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

Examples

Display the calculation result in the <output> element:

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

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Firefox, Opera, Chrome and Safari browsers support the for attribute.

Note:Internet Explorer browser does not support the <output> tag.


Definition and Usage

The for attribute specifies the relationship between the elements used in the calculation and the calculation result.


Differences between HTML 4.01 and HTML5

The <output> tag is a new tag in HTML5.


Syntax

<output for="element_id">

Attribute Values

Value Description
element_id Specifies a space-separated list of one or more element ids. These elements describe the relationship between the elements used in the calculation and the calculation result.


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