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

HTML Reference Manual

HTML Tag Reference

HTML: <button> form attribute

This article introduces the usage of the HTML button form attribute, online examples demonstrate how to use the HTML button form attribute, browser compatibility, syntax definition, and detailed information about its attribute values, etc.

 HTML <button> tag

Online Example

Button located outside the form (but still part of the form):

<!DOCTYPE html>
<html>
<head>
<title>HTML: <button> form attribute - 基础教程网 oldtoolbag.com</title>
<body>
<form action="demo-form.php" method="get" id="form1">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
</form>
<p>The button below is outside the form element, but is still part of the form.</p>
<button type="submit" form="form1" value="submit">submit</button>
</body>
</html>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Except for the Internet Explorer browser, all major browsers support the form attribute.

Definition and Usage

The form attribute specifies one or more forms to which the button belongs.

HTML 4.01 with HTML5difference

The form attribute is a HTML5new attribute.

Syntax

<button form="form_id">

Attribute value

ValueDescription
form_idThe id of the form to which the button belongs. If you need to reference more than one form, use a space-separated list.
 HTML <button> tag