Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML DOM Input Time object


May 06, 2021 JavaScript with HTML DOM Reference book


Table of contents


HTML DOM Input Time object


Input Time object

Input Time objects are new to HTML5.

The Input Time object represents an HTML-lt;input> element that uses the type-"time" property.

Note: Internet Explorer or Firefox browsers do not support HTML and input elements that use the type-"time" property.

Access the Input Time object

You can use the getElementById() function to access the elements that use the type"time" property:

var x = document.getElementById("myTime"); Give it a try

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

Create an Input Time object

You can use the document.createElement() method to create an element that uses the type-"time" property:

var x = document.createElement("INPUT");
x.setAttribute("type", "time"); Give it a try

Input Time object properties

Property Describe
autocomplete Set or return the autocomplete property value of the time field
autofocus Set or return whether the time field automatically gets focus after the page is loaded
defaultValue Set or return the default value for the time field
disabled Set or return whether the time field is available
form Returns a form reference that uses the time field
list Returns a datalist reference that contains the time field
max Set or return the max property value of the time field
min Set or return the min property value of the time field
name Set or return the name property value of the time field
readOnly Set or return whether the time field is read-only
required Set or return whether the time field is required in the form
step Set or return the step property value of the time field
type Returns the form element type of the time field
value Set or return the value property value 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 slt;input.gt; Tags

HTML Reference Manual: HTML slt;input> type property