HTMLTextAreaElement: textLength property

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

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

{{ APIRef("HTML DOM") }}

The **textLength** read-only property of the {{DOMxRef("HTMLTextAreaElement")}} interface is a non-negative integer representing the number of characters, in {{glossary("UTF-16", "UTF-16 code units")}}, of the {{htmlelement("textarea")}} element's value. It is a shortcut of accessing {{jsxref("String/length", "length")}} on its {{domxref("HTMLTextAreaElement/value", "value")}} property.

Value

A non-negative integer.

Examples

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{HTMLElement("textarea")}}
  • {{DOMXref("HTMLTextAreaElement.rows")}}
  • {{DOMXref("HTMLTextAreaElement.cols")}}
  • {{DOMXref("HTMLTextAreaElement.minLength")}}
  • {{DOMXref("HTMLTextAreaElement.maxLength")}}