Set a text area to be read-only:
The readOnly property sets or returns whether the contents of a text area should be read-only.
In a read-only text area, the content cannot be changed, but a user can tab to it, or highlight and copy the content from it.
This property reflects the HTML readonly attribute.
Tip: To prevent the user from interacting with the text area, use the disabled property instead.
The readOnly property is supported in all major browsers.
Return the readOnly property:
Set the readOnly property:
Value | Description |
---|---|
true|false |
Specifies whether a text area should be read-only or not.
|
Return Value: | A Boolean, returns true if the text area is read-only, otherwise it returns false |
---|
Find out if a text area is read-only or not:
The result of x will be: