Input Time max attribute

Definition and usage

max properties to set or return the value of the max attribute of the time field.

HTML max attribute to specify the maximum value (time) for the time field.

Tip:Use max and min properties 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 longest allowed time for the time field:

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

Try it yourself

Example 2

Change the longest allowed time:

document.getElementById("myTime").max = "23:59";

Try it yourself

Syntax

Return max attribute:

timeObject.max

Set max attribute:

timeObject.max = hh:mm:ss.ms

Attribute value

Value Description
hh:mm:ss.ms

The longest time allowed for the specified time field.

Component description:

  • hh - Hours (e.g., 22 indicates 10 PM)
  • mm - Minutes (e.g., 30)
  • ss - Seconds (e.g., 03)
  • ms - Milliseconds (e.g., 20)

Examples: "08:39:21.33", "22:36:07" or "15:00".

Technical details

Return value: A string value representing the maximum time allowed for the time field.

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

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

Note:The <input type="time"> element does not display as any time field in Firefox.