Input Time min Attribute

Definition and Usage

min attribute to set or return the value of the min attribute of the time field.

HTML min attribute to specify the minimum value of the time field (time).

Tip:Use max and min attributes to create a series of valid values.

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

See also:

HTML Reference Manual:HTML <input> min 属性

Instance

Example 1

Get the shortest time allowed by the time field:

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

Try It Yourself

Example 2

Change the minimum value:

document.getElementById("myTime").min = "08:00";

Try It Yourself

Syntax

Return min attribute:

timeObject.min

Set min attribute:

timeObject.min = hh:mm:ss.ms

Attribute Value

Value Description
hh:mm:ss.ms

The shortest time allowed by the specified time field.

Component Description:

  • hh - Hours (e.g., 22 represents 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: 字符串值,表示时间字段允许的最小时间。

浏览器支持

表中的数字注明了首个完全支持该属性的浏览器版本。

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
支持 10.0 支持 支持 支持

注意:<input type="time"> 元素在 Firefox 中不显示为任何时间字段。