Input Date disabled Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Date


The disabled property sets or gets whether a date field is disabled.

This property reflects the HTML disabled attribute.

Set the disabled property with the following Values

Value Description
true|false Sets whether a date field should be disabled
  • true - The date field is disabled
  • false - Default. The date field is not disabled

Return Value

A Boolean, returns true if the date field is disabled, otherwise it returns false

The following code shows how to disable a date field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<input type="date" id="myDate"><br><br>

<button onclick="disableBtn()">Disable Date Field</button>
<button onclick="undisableBtn()">Enable Date Field</button>

function disableBtn() {//from  w  w  w. j av  a  2  s .c  om
    document.getElementById("myDate").disabled = true;

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


Related Tutorials