Open In App

HTML DOM Input Time select() Method

Last Updated : 29 Aug, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

The input Time select() method in HTML DOM is used in selecting the content of the time text field.

Syntax:

timeObject.select()

Parameters: It does not accept any parameter. 

Return Value: It does not return any value.

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

HTML
<!DOCTYPE html>
<html>

<head>
    <title>
        DOM Input Time select() Method
    </title>
</head>

<body>
    <center>
        <h1 style="color:green;">
            GeeksForGeeks
        </h1>
        
        <h2>DOM Input Time select() Method </h2>
        
        <label for="uname" style="color:green">
            <b>Enter time</b>
        </label>
        
        <input type="time" id="gfg" name="Geek_time" 
            value="18:00" placeholder="Enter time" 
            step="5" min="16:00"
            max="22:00:" autofocus>
        <br>

        
<p>
            <b>
                Click on the below Button to select
                the content of the Time field
            </b>
        </p>


        <br>
        <button type="button" onclick="geeks()">
            Click
        </button>

        <p id="GFG" style="font-size:24px;
                color:green'">
        </p>

    </center>

    <script>
        function geeks() {
            var link = document
                .getElementById("gfg").select();
        }
    </script>
</body>

</html>

Output: 

HTML DOM Input Time select() Method
HTML DOM Input Time select() Method

Supported Browsers:

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

Next Article
Article Tags :

Similar Reads