Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Input Email name property

Input Email name property

Input Email Object Reference Input Email Object

Example

Get the name of the email field:

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

x

The output is:

usremail

Try it »


Definition and Usage

The name property is used to set or return the value of the name attribute of the email field.

The name attribute is typically used as the identifier for submitting form data to the server, or as a reference identifier for JavaScript on the client side.

**Note:** Only after setting the name attribute can data be submitted to the server upon form submission.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the name attribute

Note: Internet Explorer 9 (and earlier IE versions) or Safari browser does not support the HTML element with type="email". .


Syntax

Return the name attribute:

emailObject

.name

Set the name attribute:

emailObject

.name=

name

Attribute values

Value Description
name Describes the name of the email field

Technical Details

Return Value: String, representing the name of the email field

More examples

Example

Modify the name of the email field:

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

Try it »


Related pages

HTML Reference Manual: HTML name attribute


Input Email Object Reference Input Email Object