Input Email name attribute

Definition and Usage

name Set or return the value of the name attribute of the email field.

The HTML name attribute is used to identify form data after the form data is submitted to the server, or to reference form data on the client using JavaScript.

Note:Only form elements that have a name attribute will pass their values when submitting the form.

See also:

HTML Reference Manual:HTML <input> name attribute

Example

Example 1

Get the name of the email field:

var x = document.getElementById("myEmail").name;

Try it yourself

Example 2

Change the name of the email field:

document.getElementById("myEmail").name = "newEmailName";

Try it yourself

Syntax

Return the name attribute:

emailObject.name

Set name attribute:

emailObject.name = name

Attribute value

Value Description
name Specifies the name of the email field.

Technical details

Return value: A string value that represents the name of the email field.

Browser support

The numbers in the table indicate the first browser version to fully support this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support