Javascript examples for DOM HTML Element:Input Month
The disabled property sets or gets whether a month 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 month field should be disabled |
A Boolean, returns true if the month field is disabled, otherwise it returns false
The following code shows how to disable a month field:
<!DOCTYPE html> <html> <body> <input type="month" id="myMonth"><br><br> <button onclick="disableBtn()">Disable Month Field</button> <button onclick="enableBtn()">Enable Month Field</button> <script> function disableBtn() {// w ww .j a v a 2 s . co m document.getElementById("myMonth").disabled = true; } function enableBtn() { document.getElementById("myMonth").disabled = false; } </script> </body> </html>