Latest web development tutorials
 

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;

The result of x will be:

2014-09
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

Internet Explorer Firefox Opera Google Chrome Safari

The max property is supported in all major browsers.

Note: The max property is not supported in Internet Explorer 9 and earlier versions.

Note: The <input type="month"> element is not supported in Internet Explorer or 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