Disable a time field:
document.getElementById("myTime").disabled = true;
Click the button to disable the time field.
<!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 |
---|---|
true | The 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.