Input DatetimeLocal disabledProperty

Input DatetimeLocal 对象参考手册Input DatetimeLocal Object

Example

Disable the local datetime field:

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

The result output is:


Try it Yourself »

Definition and Usage

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

Elements using the disabled property are unavailable and unclickable. Disabled elements usually appear gray in the browser.

This property reflects the HTML disabled attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled attribute.

Note:Internet Explorer or Firefox browsers do not support the <input type="datetime-local"> element.


Syntax

Return the disabled property:

datetimelocalObject.disabled

Set the disabled property:

datetimelocalObject.disabled=true|false

Property Values

Value Description
true|false Describes whether the local datetime field is available.
  • true - The local datetime field is unavailable
  • false - Default. The local datetime field is available

Technical Details

Return Value: A Boolean, returns true if the local datetime field is unavailable, otherwise returns false.


More Examples

Example

Check whether the local datetime field is available:

var x = document.getElementById("myLocalDate").disabled;
xThe result output is:
true

Try it Yourself »

Example

Disable or enable the local datetime field:

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

Try it Yourself »


Related Pages

HTML Reference Manual:HTML <input> disabled Attribute


Input DatetimeLocal 对象参考手册Input DatetimeLocal Object Other Extensions