Javascript examples for DOM HTML Element:Input Email field
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 |
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:
<!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>