HTML DOM Input Time Object


Input Time Object

The Input Time object is new in HTML5.

The Input Time object represents an HTML <input> element with type="time".

Note:Internet Explorer and Firefox do not support HTML <input> elements with type="time".

Access an Input Time Object

You can use the getElementById() function to access an <input> element with type="time":

var x = document.getElementById("myTime"); Try it yourself

Tip:You can also access an Input Time object through the form'selementscollection.

Create an Input Time Object

You can use the document.createElement() method to create an <input> element with type="time":

var x = document.createElement("INPUT");
x.setAttribute("type", "time"); Try it yourself

Input Time Object Properties

Property Description
autocomplete Sets or returns the value of the autocomplete attribute of a time field
autofocus Sets or returns whether the time field automatically gets focus after the page loads
defaultValue Sets or returns the default value of the time field
disabled Sets or returns whether the time field is enabled
form Returns a reference to the form that contains the time field
list Returns a reference to the datalist that contains the time field
max Sets or returns the value of the max attribute of a time field
min Sets or returns the value of the min attribute of a time field
name Sets or returns the value of the name attribute of a time field
readOnly Sets or returns whether the time field is read-only
required Sets or returns whether the time field is a required field in the form
step Sets or returns the value of the step attribute of a time field
type Returns the form element type of the time field
value Sets or returns the value of the value attribute of a time field

Standard Properties and Events

The Input Time object also supports standardpropertiesandand events.。


Related Articles

HTML Tutorial:HTML Forms

HTML Reference Manual:HTML <input> Tag

HTML Reference Manual:HTML <input> type Attribute

Other Extensions