READONLY attribute (input, textarea, ...)
Sets whether the contents of the element are changeable.
If the state is read-only, the user cannot modify the contents of the element, but the element continues to get focus and be selectable.
If you want to prevent the user from interacting with the object, use the DISABLED attribute.
JavaScript page for this attribute: readOnly. You can find other example(s) there. |
Possible values:
This attribute has no values.
Specifying the READONLY attribute with an arbitrary value has the same effect as specifying it with no value.
For example, all of the following declarations have the same effect: readonly, readonly="true", readonly="false", readonly="on", readonly="readonly".
Although Boolean attributes may be used with no value in HTML, for XHTML compatibility, always use the READONLY attribute in the following format: readonly="readonly".
Specifying the READONLY attribute with an arbitrary value has the same effect as specifying it with no value.
For example, all of the following declarations have the same effect: readonly, readonly="true", readonly="false", readonly="on", readonly="readonly".
Although Boolean attributes may be used with no value in HTML, for XHTML compatibility, always use the READONLY attribute in the following format: readonly="readonly".
Example HTML code 1:
This example illustrates the use of the READONLY attribute:
|
||||
<textarea rows="3" readonly="readonly">Change this text!</textarea> |
||||
|
||||
Did you find this example helpful?
|
Supported by tags:
Related pages:
External links:
User Contributed Comments