Skip to content
Related Articles

Related Articles

HTML DOM Input Month select() Method

View Discussion
Improve Article
Save Article
  • Last Updated : 18 Jul, 2022
View Discussion
Improve Article
Save Article

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. 

HTML




<!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

HTML DOM Input Month select() Method

Supported Browsers: 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!