HTML DOM Input Time disabled Property

HTMLWeb DevelopmentFront End Technology

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

Syntax

Following is the syntax −

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

Boolean Values

Here, “booleanValue” can be the following −

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

Example

Let us see an example of Input Time disabled property −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<title>Input Time disabled</title>
<style>
   form {
      width:70%;
      margin: 0 auto;
      text-align: center;
   }
   * {
      padding: 2px;
      margin:5px;
   }
   input[type="button"] {
      border-radius: 10px;
   }
</style>
</head>
<body>
<form>
<fieldset>
<legend>Time-disabled</legend>
<label for="TimeSelect">Meeting At:
<input type="time" id="TimeSelect" value="15:10">
</label>
<input type="button" onclick="confirmMeet()" value="Confirm Meeting">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
   var divDisplay = document.getElementById("divDisplay");
   var inputTime = document.getElementById("TimeSelect");
   function confirmMeet() {
      inputTime.disabled = true;
      divDisplay.textContent = 'Meeting fixed at : '+inputTime.value;
   }
</script>
</body>
</html>

Output

This will produce the following output −

Before clicking ‘Confirm Meeting’ button −

After clicking ‘Confirm Meeting’ button −

raja
Published on 25-Jul-2019 15:12:16
Advertisements