THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Input Email value Property

Input Email Object Reference Input Email Object

Example

Change the email address of an email field:

document.getElementById("myEmail").value = "steve@w3schools.com";
Try it yourself »

Definition and Usage

The value property sets or returns the value of the value attribute of an email field.

The value attribute specifies the default value OR the value a user types in (or a value set by a script).

The value can be a single e-mail address, or a list of e-mail addresses.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The value property is supported in all major browsers.

Note: The <input type="email"> element is not supported in Internet Explorer 9 and earlier versions, or in Safari.


Syntax

Return the value property:

emailObject.value

Set the value property:

emailObject.value=text

Property Values

Value Description
text Specifies a single e-mail address, or a list of e-mail addresses

Technical Details

Return Value: A String, or a comma-separated list of strings, representing a valid email address

More Examples

Example

Get the email address of an email field:

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

The result of x will be:

johndoe@example.com
Try it yourself »

Example

An example that shows the difference between the defaultValue and value property:

var x = document.getElementById("myEmail");
var defaultVal = x.defaultValue;
var currentVal = x.value;
Try it yourself »

Related Pages

HTML reference: HTML <input> value attribute


Input Email Object Reference Input Email Object