Input Number disabled attribute
Definition and Usage
disabled
Set or return whether the number field should be disabled.
Disabled elements are not available and cannot be clicked. By default, disabled elements are usually displayed in gray in the browser.
This property reflects the HTML disabled attribute.
See also:
HTML Reference Manual:HTML <input> disabled Attribute
Example
Example 1
Disable the number field:
document.getElementById("myNumber").disabled = true;
Example 2
Check if the number field is disabled:
var x = document.getElementById("myNumber").disabled;
Example 3
Disable and enable the number field:
function disableBtn() { document.getElementById("myNumber").disabled = true; } function undisableBtn() { document.getElementById("myNumber").disabled = false; }
Syntax
Return the disabled attribute:
numberObject.disabled
Set the disabled attribute:
numberObject.disabled = true|false
Attribute Value
Value | Description |
---|---|
true|false |
Specifies whether the numeric field should be disabled
|
Technical Details
Return Value: | Boolean value, returned if the numeric field is disabled true ; otherwise return false . |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |