Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML | DOM Input Email value Property

Improve Article
Save Article
  • Difficulty Level : Basic
  • Last Updated : 25 Aug, 2022
Improve Article
Save Article

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>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. 

html




<!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 5
  • Edge 12
  • Firefox
  • Opera 11
  • Safari

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!