Open In App

HTML DOM Input Email minLength Property

Last Updated : 21 Jun, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

The Input Email minLength property in HTML DOM is used to set or return the value of the minlength attribute of an Email Input Field. It specifies the minimum number of characters that have been allowed in the email field. 

Syntax:

  • It returns the Input Email minLength property.
emailObject.minLength
  • It is used to set the Input Email minLength property.
emailObject.minLength = number

Property Values: It contains a single value number which is used to specify the minimum number of characters that are allowed in the Email minlength Field.

Return Value: It returns a numeric value that represents the minimum number of characters that have been allowed in the Email minlength field. 

Example 1: This example illustrates how to return the Input Email minLength property.

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM Input Email minlength Property
    </title>
</head>
 
<body style="text-align:center;">
    <h1> GeeksforGeeks</h1>
    <h2>DOM Input Email minLength Property</h2>
    <form id="myGeeks">
        E-mail:
        <input type="email" id="email"
               minlength="45"
               value="manaschhabra22@gmail.com">
    </form>
      <br>
 
    <button onclick="myGeeks()">
        Click Here!
    </button>
    <p id="GFG" style="font-size:25px;color:green;"></p>
 
    <!-- Script to access input element with
            type email attribute -->
    <script>
        function myGeeks() {
            let em = document.getElementById("email").minLength;
            document.getElementById("GFG").innerHTML = em;
        }
    </script>
   
</body>
 
</html>


Output:

 

 Example 2: This example illustrates how to set the Input Email minLength property.

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM Input Email minlength Property
    </title>
</head>
 
<body style="text-align:center;">
    <h1> GeeksforGeeks</h1>
    <h2>DOM Input Email minLength Property</h2>
    <form id="myGeeks">
        E-mail:
        <input type="email" id="email"
               minlength="45"
               value="manaschhabra22@gmail.com">
    </form>
    <br>
    <button onclick="myGeeks()">
        Click Here!
    </button>
    <p id="GFG" style="font-size:25px;color:green;"></p>
 
    <!-- Script to access input element with
            type email attribute -->
    <script>
        function myGeeks() {
            let em =
                document.getElementById("email").minLength = "23";
            document.getElementById("GFG").innerHTML = em;
        }
    </script>
</body>
 
</html>


Output:

 

Supported Browsers: The browsers supported by HTML DOM Input Email minLength Property are listed below:

  • Google Chrome 5
  • Edge 12
  • Firefox
  • Apple Safari
  • Opera 11


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads