HTMLTextAreaElement: cols property

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

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

{{ APIRef("HTML DOM") }}

The **cols** property of the {{DOMxRef("HTMLTextAreaElement")}} interface is a positive integer representing the visible width of the multi-line text control, in average character widths. It reflects the <textarea> element's [cols](/en-US/docs/Web/HTML/Reference/Elements/textarea#cols) attribute.

Value

A positive integer. Defaults to 20.

Examples

js
const textareaElement = document.getElementById("comment");
textArea.cols = 80;

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{HTMLElement("textarea")}}
  • {{DOMXref("HTMLTextAreaElement.rows")}}
  • {{DOMXref("HTMLTextAreaElement.wrap")}}
  • CSS {{cssxref("resize")}} property