Open In App

HTML DOM Input Month select() Method

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

Syntax:



monthObject.select()

Parameters: It does not accept any parameter.

Return Value: It does not return any value.



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




<!DOCTYPE html>
<html>
<head>
    <title>
        HTML DOM Input Month select() Method
    </title>
</head>
<body style="text-align:center;">
    <h1>GeeksForGeeks</h1>
    <h2>DOM Input Month select() Method</h2>
    <form id="myGeeks">
        <input type="month" id="month_id"
            name="geeks" autofocus>
    </form>
    <br>
    <b>
     
<p>
        Click on the below button to select
        the content of Month field.
    </p>
 
    </b>
    <button onclick="myGeeks()">
        Click Here!
    </button>
    <p id="GFG" style="font-size:20px;"></p>
 
 
    <!-- Script to Get the content of a Month field-->
    <script>
        function myGeeks() {
 
            // select the content of the Input month field .
            var gfg =
                document.getElementById(
                    "month_id").select();
        }
    </script>
</body>
</html>

Output:

HTML DOM Input Month select() Method

Supported Browsers: 


Article Tags :