<input> - time


HTML DOM Input Time object


Input Time object

The Input Time object is new in HTML5.

An Input Time object represents an HTML <input> element using the type="time" attribute.

Note: HTML <input> elements with the type="time" attribute are not supported by Internet Explorer or Firefox browsers.

Access the Input Time object

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

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

Try It! 

Tip: You can also access the Input Time object through the form's elements collection.

Create an Input Time object

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

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

 Try It! 

Input Time Object Attribute

AttributeDescription
autocompleteSets or returns the value of the autocomplete attribute of the time field
autofocusSets or returns whether the time field automatically gets the focus after the page loads
defaultValueSets or returns the default value of the time field
disabledSets or returns whether the time field is available
formReturns a form reference using the time field
listReturns a datalist reference containing the time field
maxSets or returns the value of the max attribute of the time field
minSets or returns the value of the min attribute of the time field
nameSets or returns the value of the name attribute of the time field
readOnlySets or returns whether the time field is read-only
requiredSets or returns whether the time field is required in the form
stepSets or returns the value of the step attribute of the time field
typeReturns the form element type of the time field
valueSets or returns the value of the value attribute of the time field

Standard Properties and Events

Input Time objects also support standard properties and events .


Related articles

HTML Tutorial: HTML Forms

HTML Reference Manual: HTML <input> Tag

HTML Reference Manual: HTML <input> type attribute