Easy Tutorial
❮ Prop Node Attributes Met Win Scrollto ❯

Input Datetime disabled Attribute

Input Datetime Object

Example

Disable the datetime field:

document.getElementById("myDatetime").disabled = true;

Result output:


Definition and Usage

The disabled attribute is used to set or return whether the datetime field is disabled.

Elements with the disabled attribute are unusable and unclickable. Disabled elements are typically displayed as grayed out in the browser.

This attribute reflects the HTML disabled attribute.


Browser Support

All major browsers support the disabled attribute.

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


Syntax

Return the disabled attribute:

Set the disabled attribute:

Attribute Values

Value Description
true false Describes whether the datetime field is usable. true - The datetime field is unusable<br> false - Default. The datetime field is usable

Technical Details

| Return Value: | Boolean, returns true if the datetime field is unusable, otherwise returns false | | --- | --- |


More Examples

Example

Check if the datetime field is usable:

var x = document.getElementById("myDatetime").disabled;
true

Example

Disable and enable the datetime field:

function disableBtn() {    document.getElementById("myDatetime").disabled = true;
}
function undisableBtn() {    document.getElementById("myDatetime").disabled = false;
}

Related Pages

HTML Reference: HTML <input> disabled Attribute


❮ Prop Node Attributes Met Win Scrollto ❯