Skip to main content
readonly attribute | readOnly property

Sets or retrieves the value indicated whether the content of the object is read-only.


HTML<element readonly="p" ... >

p = object.readOnly


Property values

Type: Boolean

false (false)

Default. Property is not set on the object.

true (true)

Object is set to read-only.


If the value of the readOnly property is set to true, the user cannot enter or edit text in the control. When set to true, the property still allows the object to receive the focus, whereas the disabled property does not.

See also

input type=email
input type=number
input type=password
input type=range
input type=search
input type=tel
input type=text
input type=url