Input Datetime disabled Attribute
Definition and Usage
disabled
Sets or returns whether the date and time field should be disabled.
Disabled elements are not available and cannot be clicked. By default, disabled elements are usually displayed in gray in the browser.
This property reflects the HTML disabled attribute.
See also:
HTML Reference Manual:HTML <input> disabled Attribute
Example
Example 1
Disable the date and time field:
document.getElementById("myDatetime").disabled = true;
Example 2
Check if the date and time field is disabled:
var x = document.getElementById("myDatetime").disabled;
Example 3
Disable and enable the date and time field:
function disableBtn() { document.getElementById("myDatetime").disabled = true; } function undisableBtn() { document.getElementById("myDatetime").disabled = false; }
Syntax
Return the disabled attribute:
datetimeObject.disabled
Set the disabled attribute:
datetimeObject.disabled = true|false
Attribute value
Value | Description |
---|---|
true|false |
Specifies whether the date and time field should be disabled
|
Technical details
Return value: | Boolean value, returned if the date and time field is disabled true , otherwise return false . |
---|
Browser Support
The numbers in the table indicate the first browser version to fully support this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |
Note:The <input type="datetime"> element does not display any date and time field/calendar in any mainstream browser except Safari.