Input Month valueProperty

Input Month 对象参考手册Input Month Object

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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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:
  • YYYY - Year (e.g., 2011)
  • MM - Month (e.g., 01 for January)

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 对象参考手册Input Month Object Other Extensions