Tutorials References Menu

HTML <form> name Attribute

❮ HTML <form> tag

Example

An HTML form with a name attribute:

<form action="/action_page.php" method="get" name="myForm">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <input type="button" onclick="formSubmit()" value="Send form data!">
</form>
Try it Yourself »

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.


Browser Support

Attribute
name Yes Yes Yes Yes Yes

Syntax

<form name="text">

Attribute Values

Value Description
text Specifies the name of the form

❮ HTML <form> tag