Input Email value attribute
Definition and Usage
value
Sets or returns the value of the value attribute of the email field.
The HTML value attribute specifies the default value or the value entered by the user (or the value set by the script).
The value can be a single email address or a list of email addresses.
See also:
HTML Reference Manual:HTML <input> value Attribute
Example
Example 1
Change the email address in the email field:
document.getElementById("myEmail").value = "steve@codew3c.com";
Example 2
Get the email address from the email field:
var x = document.getElementById("myEmail").value;
Example 3
Example to show the difference between defaultValue and value attributes:
var x = document.getElementById("myEmail"); var defaultVal = x.defaultValue; var currentVal = x.value;
Syntax
Return the value attribute:
emailObject.value
Set the value attribute:
emailObject.value = text
Attribute Value
Value | Description |
---|---|
text | Specifies a single email address or a list of email addresses. |
Technical Details
Return Value: | A string value or a comma-separated list of string values representing a valid email address. |
---|
Browser Support
The numbers in the table indicate the first browser version that fully supports this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |