Properties


READONLY Attribute | readOnly Property

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

Syntax

HTML<ELEMENT READONLY ... >
Scripting[ bRead = ] object.readOnly

Possible Values

bReadBoolean that specifies or receives one of the following values.
false
Default. Property is not set on the object.
true
Object is set to read-only.

The property is read/write. The property has a default value of false.

DHTML expressions can be used in place of the preceding value(s). As of Internet Explorer 8, expressions are not supported in IE8 mode. For more information, see About Dynamic Properties.

Remarks

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.

Standards Information

This property is defined in HTML 4.0 World Wide Web link and is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 World Wide Web link.

Applies To

INPUT type=text, INPUT type=password, TEXTAREA, HTMLInputElement Constructor, HTMLTextAreaElement Constructor
Tags :


Community Content

baggs
readOnly vs disabled

Another difference between the readOnly and disabled properties is when a form is submitted. The contents of a readOnly object are submitted with the form while a disabled object is not submitted.

Tags : dhtml

Page view tracker