HTML DOM
The wrap property of the HTMLTextAreaElement interface indicates how the control should wrap the value for form submission. It reflects the <textarea> element's wrap attribute. Note that the "hard" value only has an effect when the HTMLTextAreaElement.cols attribute is also set.
Value
See wrap for the possible values. Defaults to "soft".
Examples
const textareaElement = document.getElementById("comment");
const oldWrap = textArea.wrap;
textArea.wrap = "hard"; // Add line breaks (CR+LF) during form submission
Specifications
Browser compatibility
See also
- textarea
- HTMLTextAreaElement.cols
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
