THE WORLD'S LARGEST WEB DEVELOPER SITE

Input Month max Property

❮ Input Month Object

Example

Get the maximum month and year allowed for a month field:

var x = document.getElementById("myMonth").max;
Try it Yourself »

Definition and Usage

The max property sets or returns the value of the max attribute of a month field.

The max attribute specifies the maximum value (month and year) for a month field.

Tip: Use the max attribute together with the min attribute to create a range of legal values.

Tip: To set or return the value of the min attribute, use the min property.


Browser Support

Property
max Yes 10.0 Yes Yes Yes

Note: The <input type="month"> element does not show any date field/calendar in Firefox.



Syntax

Return the max property:

monthObject.max

Set the max property:

monthObject.max = YYYY-MM

Property Values

Value Description
YYYY-MM Specifies the maximum month and year allowed. Explanation of components:
  • YYYY - year (e.g. 2011)
  • MM - month (e.g. 01 for January)

Technical Details

Return Value: A String, representing the maximum month and year allowed

More Examples

Example

Change the maximum month and year:

document.getElementById("myMonth").max = "2014-12";
Try it Yourself »

Related Pages

HTML reference: HTML <input> max attribute


❮ Input Month Object