HTML DOM Input Date disabled Property

HTMLWeb DevelopmentFront End Technology

The HTML DOM Input Date disabled property sets/returns whether Input Date is enabled or disabled.

Syntax

Following is the syntax −

  • Returning boolean value - true/false
inputDateObject.disabled
  • Setting disabled to booleanValue
inputDateObject.disabled = booleanValue

Boolean Value

Here, “booleanValue” can be the following −

booleanValueDetails
trueIt defines that the input date is disabled.
falseIt defines that the input date is not disabled and it is also the default value.

Example

Let us see an example of Input Date disabled property −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<title>Input Date Disabled</title>
</head>
<body>
<form>
Date Select: <input type="date" id="dateSelect" disabled>
</form>
<button onclick="enableDateInput()">Enable Date Input</button>
<div id="divDisplay"></div>
<script>
   var divDisplay = document.getElementById("divDisplay");
   var inputDate = document.getElementById("dateSelect");
   divDisplay.textContent = 'Date Input disabled: '+inputDate.disabled;
   function enableDateInput() {
      inputDate.disabled = false;
      divDisplay.textContent = 'Date Input disabled: '+inputDate.disabled;
   }
</script>
</body>
</html>

Output

This will produce the following output −

Before clicking ‘Enable Date Input’ button −

After clicking ‘Enable Date Input’ button −

raja
Published on 19-Jul-2019 10:52:14
Advertisements