HTML | DOM Input Email minLength Property

The Input Email minLength property in HTML DOM is used to set or return the value of minlength attribute of a 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 single value number which is used to specify the minimum number of characters that are allowed in the Email maxlength Field.

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

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



filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html> 
<html
      
<head
    <title
        HTML DOM Input Email maxlength Property 
    </title
</head>     
  
<body style="text-align:center;"
  
    <h1> GeeksforGeeks</h1
  
    <h2>DOM Input Email maxLength Property</h2
      
    <form id="myGeeks"
        E-mail: <input type="email" id="email" maxlength="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() { 
            var em = document.getElementById("email").maxLength; 
            document.getElementById("GFG").innerHTML = em; 
        
    </script
</body
  
</html>                     

chevron_right


Output:

  • Before clicking on the Button:
  • After clicking on the Button:

Example 2: This example illustrate how to set the Input Email maxLength property.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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() { 
            var em = document.getElementById("email").minLength="23"; 
            document.getElementById("GFG").innerHTML = em; 
        
    </script
</body
  
</html>                     

chevron_right


Output:

  • Before clicking on the Button:
  • After clicking on the Button:

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

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.