Input Time disabled Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Time

Description

The disabled property sets or gets whether a time field should be disabled.

This property reflects the HTML disabled attribute.

Set the disabled property with the following Values

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

Return Value

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="time" id="myTime"><br><br>

<button onclick="disableBtn()">Disable Time Field</button>
<button onclick="enableBtn()">Enable Time Field</button>

<script>
function disableBtn() {/* w  w w  . j a  v a2 s  .  c o  m*/
    document.getElementById("myTime").disabled = true;
}

function enableBtn() {
    document.getElementById("myTime").disabled = false;
}
</script>

</body>
</html>

Related Tutorials