HTML DOM Input Month select() Method
Last Updated :
29 Aug, 2022
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 >
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:
- Google Chrome 20 and above
- Edge 12 and above
- Opera 11 and above
Share your thoughts in the comments
Please Login to comment...