Input Email value Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Email field

Description

The value property sets or gets the value attribute of an email field, which can be a single e-mail address, or a list of e-mail addresses.

Set the value property with the following Values

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

Return Value

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

The following code shows how to change the email address of an email field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

E-mail: <input type="email" id="myEmail" value="a@example.com">

<p>Click the button to display the email address of the email field.</p>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//  w w w  . j  a  va2s .  co m
    document.getElementById("myEmail").value = 'new value';

}
</script>
</body>
</html>

Related Tutorials