Latest web development tutorials
 

Input Email value Property

< Input Email Object

Example

Change the email address of an email field:

document.getElementById("myEmail").value = "[email protected]";
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

Property
value Yes 10.0 Yes Yes Yes

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:

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