Back to Content

HTMLTextAreaElement: readOnly property

files/en-us/web/api/htmltextareaelement/readonly/index.md

latest824 B
Original Source

{{ APIRef("HTML DOM") }}

The readOnly property of the {{DOMxRef("HTMLTextAreaElement")}} interface indicates that the user cannot modify the value of the control. Unlike the {{domxref("HTMLTextAreaElement.disabled", "disabled")}} attribute, the readonly attribute does not prevent the user from clicking or selecting in the control. It reflects the {{htmlelement("textarea")}} element's readonly attribute.

Value

A boolean.

Examples

js
const textareaElement = document.getElementById("comment");
console.log(textArea.readOnly);

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{HTMLElement("textarea")}}
  • {{DOMXref("HTMLTextAreaElement.disabled")}}
  • {{cssxref(":read-only")}} pseudo-class