Javascript DOM HTML Input Time disabled Property set

Introduction

Disable a time field:

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

Click the button to disable the time field.

View in separate window

<!DOCTYPE html>
<html>
<body>

<input type="time" id="myTime">
<button onclick="myFunction()">Test</button>

<script>
function myFunction() {//from  ww w .j  ava  2  s  .co  m
  document.getElementById("myTime").disabled = true;
}
</script>

</body>
</html>

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

This property mirrors the HTML disabled attribute.

The <input type="time"> element not supported in Firefox.

The disabled property accepts and returns a boolean type value.

Value Description
trueThe time field is disabled
false Default. The time field is not disabled

The disabled property returns true if the time field is disabled, otherwise it returns false.




PreviousNext

Related