HTML DOM Input DatetimeLocal Object
Input DatetimeLocal Object
The Input DatetimeLocal object is new in HTML5.
The Input DatetimeLocal object represents an HTML element with type="datetime-local". .
**Note:** Internet Explorer or Firefox browser does not support .
Accessing the Input DatetimeLocal Object
You can use the getElementById() function to access an element with a type="datetime-local" attribute. element:
var x = document.getElementById("myLocalDate");
Try it
Tip: You can also access the Input Color object through a form'sElementcollection to access the Input DatetimeLocal object.
Creating the Input DatetimeLocal Object
You can use the document.createElement() method to create an element with a type="datetime-local" attribute. element:
var x = document.createElement("INPUT");
x.setAttribute("type", "datetime-local");
Try it
Input DatetimeLocal Object Properties
| property | Description |
|---|---|
| autocomplete | Sets or returns the autocomplete attribute value of the local datetime field. |
| autofocus | Sets or returns whether the local datetime field automatically gets focus after the page loads. |
| defaultValue | Sets or returns the default value of the local datetime field. |
| disabled | Sets or returns whether the local datetime field is enabled. |
| form | Returns a reference to the form using the local datetime field. |
| list | Returns a reference to the datalist containing the local datetime field. |
| max | Sets or returns the max attribute value of the local datetime field. |
| min | Sets or returns the min attribute value of the local datetime field. |
| name | Sets or returns the name attribute value of the local datetime field. |
| readOnly | Sets or returns whether the local datetime field is read-only. |
| required | Sets or returns whether the local datetime field is required in the form. |
| step | Sets or returns the step attribute value of the local datetime field. |
| type | Returns the form element type of the local datetime field. |
| value | Sets or returns the value attribute of the local datetime field. |
Standard properties and events
The Input DatetimeLocal object also supports standard property and Events.
Related Articles
HTML Tutorial: HTML Forms
HTML Reference Manual: HTML tag
HTML Reference Manual: HTML type Attribute