English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Reference

HTML output form attribute

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

 HTML <output> tag

Online Example

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

<!DOCTYPE html>
<html>
<head>
<title>HTML:<output> form attribute - 基础教程网(oldtoolbag.com)</title>
</head>
<body>
<form action="action_page.php" id="numform" oninput="x.value=parseInt(a.value)+parseInt(b.value)>0
<input type="range" id="a" name="a" value="30">100
+<input type="number" id="b" name="b" value="30">
<br><br>
<input type="submit">
</form>
<p>The output element below is outside the form, but is still part of the form.</p>
<output form="numform" name="x" for="a b"></output>
</body>
</html>
Test to see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Almost all mainstream browsers do not support the form attribute.

Definition and Usage

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

HTML 4.01 with HTML5difference

The <output> tag is an HTML5 of the new tag.

Syntax

<output form="form_id">

Attribute Value

ValueDescription
form_idSpecifies the form element that the <output> element belongs to. The value of this attribute must be the id attribute of a <form> element in the same document.
 HTML <output> tag