HTML | DOM Input Email value Property
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.
html
<!DOCTYPE html> < html > < head > < title > HTML DOM Input Email value Property </ title > </ head > < body style="text-align:center;"> < h1 >w3wiki</ h1 > < h2 >DOM Input Email value Property</ h2 > E-mail: < input type="email" id="email" name="myBeginner" value="careers@w3wiki.net"> < br >< br > < button onclick="myBeginner()"> Click Here! </ button > < p id="GFG" style="font-size:20px;color:green;"></ p > <!-- Script to return Input Email value Property --> < script > function myBeginner() { 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.
html
<!DOCTYPE html> < html > < head > < title > HTML DOM Input Email value Property </ title > </ head > < body style="text-align:center;"> < h1 >w3wiki</ h1 > < h2 >DOM Input Email value Property</ h2 > E-mail: < input type="email" id="email" name="myBeginner" value="careers@w3wiki.net"> < br >< br > < button onclick="myBeginner()"> Click Here! </ button > < p id="GFG" style="font-size:20px;color:green;"></ p > <!-- Script to set Input Email value Property --> < script > function myBeginner() { 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 5
- Edge 12
- Firefox
- Opera 11
- Safari