Open In App

HTML DOM Input Email select() Method

Last Updated : 25 Aug, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The input email select() method in HTML DOM is used to select the content of the email text field. It is the in-built method of the input email object. 

Syntax:

emailObject.select()

Parameters: It does not accept any parameters. 

Return Value: It does not return any value.

Example: This example uses the input email select() method to select the content inside the email Field.  

HTML




<!DOCTYPE html>
<html>
     
<head>
    <title>
        HTML DOM Input Email select() Method
    </title>
</head>   
 
<body>
 
    <h1 style="color:green">GeeksforGeeks</h1>
 
    <h2>DOM Input Email select() method</h2>
 
     Enter E-mail Address:
     <input type="email" id="email"
            value="careers@geeksforgeeks.org" autofocus>
    <br><br>
    <button onclick="mySelect()">
        Select Contents of Email Field!
    </button>   
     
    <!-- Script to select input element with
            type email attribute -->
    <script>
        function mySelect() {
            var em = document.getElementById("email").select();
        }
    </script>
</body>
 
</html>                   


Output:

HTML DOM Input Email select() Method

HTML DOM Input Email select() Method

Supported Browsers:

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


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads