Open In App

HTML DOM Input Date select() Method

Last Updated : 15 Sep, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The Input Date select() Method in HTML DOM is used to select the contents of the Date text field. It is the predefined method of the Input date object. 

Syntax:

dateObject.select()

Parameter: This method does not contain any parameters. 

Return Values: It does not return any value. 

Example: Below example illustrates the use of the Input Date select() Method in HTML DOM. 

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>HTML DOM Input Date select() Method</title>
    <style>
        h1 {
            color: green;
        }
 
        h2 {
            font-family: Impact;
        }
 
        body {
            text-align: center;
        }
    </style>
</head>
 
<body>
    <h1>GeeksforGeeks</h1>
    <h2>Input Date select() Method</h2>
    <br>
    <input type="date" id="test_Date" autofocus>
    <p>
        To select the content of the Date Field,
        double click the "Check me!" button.
    </p>
    <button ondblclick="My_selectDate()">
        Check me!
    </button>
    <script>
        function My_selectDate() {
            var d = document.getElementById(
                    "test_Date").select();
        }
    </script>
</body>
 
</html>


Output:

Supported Browsers:

  • Google Chrome 20
  • Edge 12
  • Opera 11
  • Firefox 57
  • Safari 14.1


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

Similar Reads