<input> - datetime-local
HTML DOM Input DatetimeLocal object
Input DatetimeLocal object
The Input DatetimeLocal object is new in HTML5.
Input DatetimeLocal objects represent HTML <input> elements with type="datetime-local".
Note: The <input> element is not supported by Internet Explorer or Firefox browsers.
Access the Input DatetimeLocal object
You can use the getElementById() function to access <input> elements with the type="datetime-local" attribute:
var x = document.getElementById("myLocalDate");
Tip: You can also access the Input DatetimeLocal object through the form's elements collection.
Create an Input DatetimeLocal object
You can use the document.createElement() method to create <input> elements with the type="datetime-local" attribute:
var x = document.createElement("INPUT");
x.setAttribute("type", "datetime-local");
Input DatetimeLocal Object Attributes
Attribute | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete property of the local time field |
autofocus | Sets or returns whether the Local Time field automatically gets the focus after the page loads |
defaultValue | Sets or returns the default value for the local time field |
disabled | Sets or returns whether the Local Time field is available |
form | Returns a reference to a form that uses a local time field |
list | Returns a datalist reference that contains a local time field |
max | Sets or returns the value of the max property of the local time field |
min | Sets or returns the min property value of the local time field |
name | Sets or returns the value of the name property of the local time field |
readOnly | Sets or returns whether the Local Time field is read-only |
required | Sets or returns whether the Local Time field is required in the form |
step | Sets or returns the value of the step property of the local time field |
type | Returns the form element type for the local time field |
value | Sets or returns the value of the value property of the local time field |
Standard Properties and Events
Input DatetimeLocal 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