Input Date disabled Attribute

Definition and Usage

disabled Set or return whether the date 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 field:

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

Try It Yourself

Example 2

Check if the date field is disabled:

var x = document.getElementById("myDate").disabled;

Try It Yourself

Example 3

Disable and enable the date field:

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

Try It Yourself

Syntax

Return the disabled attribute:

inputdateObject.disabled

Set the disabled attribute:

inputdateObject.disabled = true|false

Attribute Value

Value Description
true|false

Specify whether the date field should be disabled.

  • true - The date field is disabled
  • false - Default. The date field is not disabled

Technical Details

Return Value: Boolean value, returned if the date field is disabled true, otherwise return false.

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support

Note:The <input type="date"> element does not display any date field/calendar in IE11 and earlier versions.