Input Number disabled attribute
Definition and Usage
disabled
Attribute to 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 Atribute
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 disabled attribute:
numberObject.disabled
Set disabled attribute:
numberObject.disabled = true|false
Attribute Value
Value | Description |
---|---|
true|false |
Specify whether the numeric field should be disabled.
|
Technical Details
Return value: | Boolean value, if the numeric field is disabled, it will return true ; otherwise return false . |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |