English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The form attribute specifies the form to which the <input> element belongs. Specifies one or more forms to which the <input> element belongs
An input field located outside the HTML form (but still part of the form):
<!DOCTYPE html> <html> <head> <title>HTML:<input> form attribute - 基础教程网(oldtoolbag.com)</title> <body> <form action="action_page.php" id="form1"> First name: <input type="text" name="fname"><br> <input type="submit" value="Submit"> </form> <p>The "Last name" field in the above <p> is outside the form element, but it is still part of the form.</> Last name: <input type="text" name="lname" form="form1"> </html>Test to see ‹/›
IEFirefoxOperaChromeSafari
Almost all mainstream browsers support the form attribute except for Internet Explorer.
The form attribute specifies one or more forms that the <input> element belongs to.
The form attribute is an HTML5 new attribute added in.
<input form="form_id">
Value | Description |
---|---|
form_id | Specify a list of one or more forms that the <input> element belongs to, separated by spaces. |