<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");
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");
Input Time Object Attribute
Attribute | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of the time field |
autofocus | Sets or returns whether the time field automatically gets the 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 available |
form | Returns a form reference using the time field |
list | Returns a datalist reference containing the time field |
max | Sets or returns the value of the max attribute of the time field |
min | Sets or returns the value of the min attribute of the time field |
name | Sets or returns the value of the name attribute of the time field |
readOnly | Sets or returns whether the time field is read-only |
required | Sets or returns whether the time field is required in the form |
step | Sets or returns the value of the step attribute of the time field |
type | Returns the form element type of the time field |
value | Sets 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