Easy Tutorial
❮ Prop Date Name Prop Style Flexshrink ❯

HTML DOM Input Datetime Object


Input Datetime Object

The Input Datetime object represents an HTML <input> element with the type="datetime" attribute.

Note: Internet Explorer, Firefox, Opera 15 (and later versions), or Chrome support the <input> element with type="datetime".

Accessing the Input Datetime Object

You can access an <input> element with the type="datetime" attribute using the getElementById() function:

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

Creating the Input Datetime Object

You can create an <input> element with the type="datetime" attribute using the document.createElement() method:

Input Datetime Object Properties

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

Standard Attributes and Events

The Input Datetime object also supports standard attributes and events.


Related Articles

HTML Tutorial: HTML Forms

HTML Reference: HTML <input> Tag

HTML Reference: HTML <input> type Attribute

❮ Prop Date Name Prop Style Flexshrink ❯