Input Number disabled Property
Example
Disable the number field:
document.getElementById("myNumber").disabled = true;
The output result is:
Try it »
Definition and Usage
The disabled property sets or returns whether the number field is disabled.
Elements with the disabled attribute are unavailable and not clickable. Disabled elements are usually displayed in gray in the browser.
This attribute reflects the HTML disabled attribute.
Browser support





All major browsers support the disabled property
Note: Internet Explorer 9 and earlier versions do not support the HTML using the type="number" attribute .
Syntax
Return the disabled attribute:
numberObject
.disabled
Set the disabled attribute:
numberObject
.disabled=true|false
Attribute values
| Value | Description |
|---|---|
| true|false | Describes whether the number field is available.
|
Technical Details
| Return Value: | A Boolean value: returns true if the number field is unavailable, otherwise returns false |
|---|
More examples
Example
Check whether the number field is available:
var x = document.getElementById("myNumber").disabled;
x
The output is:
true
Try it »
Example
Disable or enable the number field:
function disableBtn() {
document.getElementById("myNumber").disabled = true;
}
function undisableBtn() {
document.getElementById("myNumber").disabled = false;
}
Try it »
Related pages
HTML Reference Manual: HTML disabled attribute
Input Number Object