HTML <input> nameAttributes

HTML input 标签参考手册HTML <input> Tag

Examples

An HTML form with three input fields, two text fields and one submit button:

<form action="demo_form.php">
Name: <input type="text" name="fullname"><br>
Email: <input type="text" name="email"><br>
<input type="submit" value="Submit">
</form>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the name attribute.


Definition and Usage

The name attribute specifies the name of the <input> element.

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

Note:Only form elements with a name attribute set can pass their values when submitting a form.


Differences between HTML 4.01 and HTML5

None.


Syntax

<input name="text">

Attribute Values

Value Description
text Specifies the name of the <input> element.


HTML input 标签参考手册HTML <input> Tag Other Extensions