Latest web development tutorials

HTML DOM Input Datetime Object

Input Datetime Object

Input Datetime object is a new HTML5.

Input Datetime object representation using type = "datetime" attribute of the HTML <input> elements.

Note: Internet Explorer, Firefox, Opera 15 ( and higher) or Chrome supports the <input> element using type = "datetime".

Input Datetime Object Access

You can use getElementById () function to access using type = "datetime" <input> element attributes:

var x = document.getElementById ( "myDatetime" ); try

Tip: You can also form elements to access the Input Datetime collection of objects.

Create Object Input Datetime

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

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

Input Datetime Object Properties

Property description
autocomplete Sets or returns datetime field autocomplete attribute value
autofocus Sets or returns datetime field whether to automatically get the focus when the page loads
defaultValue Sets or returns datetime field default value
disabled Whether to set or return datetime field is disabled
form Returns datetime field in a form reference
list It returns a datetime field datalist references
max Sets or returns datetime field max attribute value
min Sets or returns datetime field property values ​​min
name Sets or returns datetime field name attribute value
readOnly Sets or returns datetime field is read-only
required Sets or returns datetime fields in the form if a required field
step Sets or returns datetime field step property values
type Returns datetime field form element type
value Sets or returns datetime field value attribute value

Standard properties and events

Input Datetime Object also supports standard attributes and events .


related articles

HTML Tutorial: HTML Forms

HTML Reference Manual: HTML <the INPUT> tag

HTML Reference Manual: HTML <the INPUT> of the type attribute