Tutorials References Exercises Bootcamps Videos Menu
Sign Up Create Website Get Certified Upgrade

HTML <form> name Attribute

❮ HTML <form> tag


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!">
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

name Yes Yes Yes Yes Yes


<form name="text">

Attribute Values

Value Description
text Specifies the name of the form

❮ HTML <form> tag