Input Week max Attribute

Definition and Usage

max Attribute sets or returns the value of the max attribute of the week field.

HTML max attribute specifies the maximum value for the week field (week and year).

Tip:The max attribute is usually used with min attribute Used together to create a series of valid values.

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

See also:

HTML Reference Manual:HTML <input> max Attribute

Instance

Example 1

Get the maximum allowed week and year for the week field:

var x = document.getElementById("myWeek").max;

Try It Yourself

Example 2

Change the maximum allowed week and year:

document.getElementById("myWeek").max = "2023-W35";

Try It Yourself

Syntax

Return max attribute:

weekObject.max

Set max attribute:

weekObject.max = YYYY-WWW

Attribute Value

Value Description
YYYY-WWW

The maximum allowed week and year as specified.

Component Description:

  • YYYY - Year (for example, 2023)
  • String "-W" represents "Week"
  • WW - Week (within the range of 1 to 52 or 53, depending on the specific year), for example, 01 represents the first week of the year

For example: 2023-W36

Technical Details

Return Value: A string value representing the maximum weeks and years allowed.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support

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