Set the month and year for a month field:
The value property sets or returns the value of the value attribute of a month field.
The value attribute specifies a month and year for the month field.
The value property is supported in all major browsers.
Note: The <input type="month"> element is not supported in Internet Explorer or Firefox.
Return the value property:
Set the value property:
Value | Description |
---|---|
YYYY-MM |
Specifies the
month and year. Explanation of components:
|
Return Value: | A String, representing the month and year of the month field |
---|
Get the month and year of a month field:
The result of x will be:
An example that shows the difference between the defaultValue and value property:
HTML reference: HTML <input> value attribute