Input Month value Property
Example
Set the year and month of the month field:
document.getElementById("myMonth").value = "2014-02";
Try it »
Definition and Usage
The value property is used to set or return the value of the value attribute of the month field.
The value property describes the year and month of the month field.
Browser support





All major browsers support the value attribute
**Note:** Internet Explorer or Firefox browsers do not support the HTML using the type="month" attribute .
Syntax
Return the value attribute:
monthObject
.value
Set the value attribute:
monthObject
.value=
YYYY-MM
Attribute values
| Value | Description |
|---|---|
| YYYY-MM | Describes the year and month. Example analysis:
|
Technical Details
| Return Value: | String, representing the year and month of the month field |
|---|
More examples
Example
Get the year and month of the month field:
var x = document.getElementById("myMonth").value;
x
The output is:
1997-11
Try it »
Related pages
HTML Reference Manual: HTML value attribute
Input Month Object