Javascript examples for DOM HTML Element:Input Time
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 |
A Boolean, returns true if the time field is disabled, otherwise it returns false
<!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>