Input Month valueProperty
Examples
Set the year and month of the month field:
document.getElementById("myMonth").value = "2014-02";
Try it Yourself »
Definition and Usage
The value property is used to set or return the value of the value attribute of the month field.
The value attribute 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 <input> elements with the type="month" attribute.
Syntax
Return the value attribute:
monthObject.value
Set the value attribute:
monthObject.value=YYYY-MM
Property Values
| Value | Description |
|---|---|
| YYYY-MM | Describes the year and month. Example breakdown:
|
Technical Details
| Return Value: | A string representing the year and month of the month field |
|---|
More Examples
Examples
Get the year and month of the month field:
var x = document.getElementById("myMonth").value;
xThe output result is:1997-11
Try it Yourself »
Related Pages
HTML Reference Manual:HTML <input> value Attribute
Input Month Object Other Extensions