English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

Complete list of HTML tags

HTML: <input> name attribute

The name attribute specifies the name of the <input> element, which is used to reference the element in JavaScript or to reference form data after submitting the form.

 HTML <input> tag

Online Example

An HTML form with three input fields; two text fields and a submit button:

<!DOCTYPE html>
<html>
<head>
<title>HTML: <input> name attribute - basic tutorial website(oldtoolbag.com)</title>
<body>
<form action="action_page.php">
  Name: <input type="text" name="fullname"><br>
  Email: <input type="text" name="email"><br>
  <input type="submit" value="Submit">
</form>
</html>
Test it out ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

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 the form is submitted.

Note: Only form elements with the name attribute will pass their values when the form is submitted.

HTML 4.01 with HTML5differences

None.

Syntax

<input name="text">

Attribute Value

ValueDescription
textSpecify the name of the <input> element.
 HTML <input> tag