Latest web development tutorials

HTML DOM Input Date disabled property

Input Date Object Reference Input Date Object

Examples

Disable date field:

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

The result could be:


try it"

Definition and Usage

disabled property sets or returns the date field is available.

Use the disabled attribute elements are not available and can not be clicked. Disabled elements are usually displayed on the browser gray.

This property reflects the HTML disabled property.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled attribute.

Note: Internet Explorer or Firefox browser does not support <input type = "date"> element.


grammar

Returns disabled properties:

inputdateObject .disabled

Set the disabled attribute:

inputdateObject .disabled=true|false

Property Value

描述
true|false 描述日期字段是否可用。
  • true - 日期字段不可用
  • false - 默认。日期字段可用。

technical details

return value: Boolean value that, if the date field is available returns true, otherwise returns false.


More examples

Examples

Check date fields are available:

var x = document.getElementById("myDate").disabled;
x The output is:
true

try it"

Examples

Disable and enable date fields:

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

try it"


Related Pages

HTML Reference Manual: HTML <the INPUT> Disabled Property


Input Date Object Reference Input Date Object