HTMLTextAreaElement: readOnly property

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{ 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](/en-US/docs/Web/HTML/Reference/Elements/textarea#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