English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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.
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 ‹/›
IEFirefoxOperaChromeSafari
Except for the Internet Explorer browser, all major browsers support the form attribute.
The form attribute specifies one or more forms to which the button belongs.
The form attribute is a HTML5new attribute.
<button form="form_id">
Value | Description |
---|---|
form_id | The id of the form to which the button belongs. If you need to reference more than one form, use a space-separated list. |