X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML <form> name Attribute

HTML form Tag Reference HTML <form> tag

Example

An HTML form with a name attribute:

<form action="form_action.asp" method="get" name="myForm">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="button" onclick="formSubmit()" value="Send form data!">
</form>

Try it Yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The name attribute is supported in all major browsers.


Definition and Usage

The name attribute specifies the name of a form.

The name attribute is used to reference elements in a JavaScript, or to reference form data after a form is submitted.


Differences Between HTML 4.01 and HTML5

NONE.


Differences Between HTML and XHTML

In XHTML, the name attribute is deprecated. Use the id attribute instead.


Syntax

<form name="text">

Attribute Values

Value Description
text Specifies the name of the form


HTML form Tag Reference HTML <form> tag

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook