Input Date disabledProperty

Input Date 对象参考手册Input Date Object

Example

Disable the date field:

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

The result could be:


Try it Yourself »

Definition and Usage

The disabled property sets or returns whether the date field is enabled.

Elements with the disabled attribute are unusable and unclickable. Disabled elements are usually displayed in gray in the browser.

This property reflects the HTML disabled attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled property.

Note:Internet Explorer and Firefox browsers do not support the <input type="date"> element.


Syntax

Return the disabled property:

inputdateObject.disabled

Set the disabled property:

inputdateObject.disabled=true|false

Property Values

Value Description
true|false Specifies whether the date field is enabled.
  • true - The date field is disabled
  • false - Default. The date field is enabled.

Technical Details

Return Value: A Boolean value: returns true if the date field is enabled, otherwise false.


More Examples

Example

Check whether the date field is enabled:

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

Try it Yourself »

Example

Disable and enable the date field:

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

Try it Yourself »


Related Pages

HTML Reference Manual:HTML <input> disabled attribute


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