Open In App

HTML DOM Input Week select() Method

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

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

Syntax:

weekbject.select()

Parameters: It does not accept any parameter.

Example: This example uses the input week select() method to select the week field.

HTML
<!DOCTYPE html>
<html>

<head>
    <title>HTML DOM Input Week select() Method</title>
</head>

<body>
    <center>
        <h1 style="color:green">
            GeeksforGeeks
        </h1>
        
        <h2>DOM Input Week Select() Method</h2>
        
        <form id="myGeeks">
            <input type="week" id="week_id" 
                name="geeks" autofocus>
        </form>
        <br>

        <button onclick="myGeeks()">
            Click Here!
        </button>
        
        <p id="GFG" style="font-size:20px;"></p>



        <!-- Script to select the content of a Input week field-->
        <script>
            function myGeeks() {
                var gfg = document.getElementById(
                    "week_id").select();
            }
        </script>
    </center>
</body>

</html>

Output: 

HTML DOM Input Week select() Method
HTML DOM Input Week select() Method

Supported Browsers:

  • Google Chrome 20
  • Edge 12
  • Opera 11

Next Article
Article Tags :

Similar Reads