The Input Email value property in HTML DOM is used to set or return the value of a value attribute of an email field. The value attribute specifies the initial value of the input Email Field. The value may be a single address or a list of addresses.
Syntax:
- It returns the Input Email value property.
emailObject.value
- It is used to set the Input Email value property.
emailObject.value = text
Property Value: It contains single value text which defines the single email address or a list of email addresses.
Return Value: It returns the string value which represent the valid email address of a user.
Example 1: This example illustrates how to return Input Email value property.
<!DOCTYPE html> < html > < head > < title > HTML DOM Input Email value Property </ title > </ head > < body style = "text-align:center;" > < h1 >GeeksforGeeks</ h1 > < h2 >DOM Input Email value Property</ h2 > E-mail: < input type = "email" id = "email" name = "myGeeks" value = "careers@geeksforgeeks.org" > < br >< br > < button onclick = "myGeeks()" > Click Here! </ button > < p id = "GFG" style = "font-size:20px;color:green;" ></ p > <!-- Script to return Input Email value Property --> < script > function myGeeks() { var em = document.getElementById("email").value; document.getElementById("GFG").innerHTML = em; } </ script > </ body > </ html > |
Output:
Before Clicking the Button:
After Clicking the Button:
Example 2: This example illustrates how to set Input Email value property.
<!DOCTYPE html> < html > < head > < title > HTML DOM Input Email value Property </ title > </ head > < body style = "text-align:center;" > < h1 >GeeksforGeeks</ h1 > < h2 >DOM Input Email value Property</ h2 > E-mail: < input type = "email" id = "email" name = "myGeeks" value = "careers@geeksforgeeks.org" > < br >< br > < button onclick = "myGeeks()" > Click Here! </ button > < p id = "GFG" style = "font-size:20px;color:green;" ></ p > <!-- Script to set Input Email value Property --> < script > function myGeeks() { var em = document.getElementById("email").value ="manaschhabra22@gmail.com"; document.getElementById("GFG").innerHTML = em; } </ script > </ body > </ html > |
Output:
Before Clicking the Button:
After Clicking the Button:
Supported Browsers: The browser supported by DOM input Email Value Property are listed below:
- Google Chrome
- Internet Explorer 10.0
- Firefox
- Opera
- Safari