Input Number readOnly
Property
Example
Set the number field to read-only:
Output result:
Definition and Usage
The readOnly
property is used to set or return whether the number field is read-only.
A read-only field cannot be modified. However, its content can be copied.
This property reflects the HTML readonly
attribute.
Tip: To ensure the accuracy of form data, you can use the disabled property instead.
Browser Support
All major browsers support the readOnly
property.
Note: Internet Explorer 9 and earlier versions do not support the <input>
element with the type="number"
attribute.
Syntax
Return the readOnly
property:
Set the readOnly
property:
Property Values
Value | Description | |
---|---|---|
true | false | Describes whether the number field is read-only<br>true - The number field is read-only<br>false - Default. The number field is not read-only |
Technical Details
| Return Value: | Boolean, returns true if the number field is read-only, otherwise returns false. | | --- | --- |
More Examples
Example
Check if the number field is read-only:
Related Pages
HTML Reference: HTML <input> readonly Attribute