English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The name attribute specifies the name of the form. The name attribute is used to reference elements in JavaScript or to reference form data after submitting the form.
HTML form with name attribute:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML <form> name Attribute Usage-Basic Tutorial(oldtoolbag.com)</title> <script> function formSubmit() { document.forms["myForm"].submit(); } </script> </head> <body> <form name="myForm" action="action_page.php" method="get"> First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br><br> <input type="button" onclick="formSubmit()" value="Send form data!"> </form> <p>Note that the JavaScript in the header uses the form's name to specify the form to be submitted.</p> </body> </html>Test it out ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the name attribute.
The name attribute specifies the name of the form.
The name attribute is used to reference elements in JavaScript or to reference form data after submitting the form.
None.
In XHTML, the name attribute is deprecated. Please use the id attribute instead.
<form name="text">
Value | Description |
---|---|
text | Specifies the name of the form. |