Textarea wrap attribute

Definition and Usage

wrap Sets or returns the wrap attribute of the text area.

The HTML wrap attribute specifies how the text in the text area should wrap when the form is submitted.

See also:

HTML Reference Manual:HTML <textarea> wrap Attribute

Example

Find out how the text in the text area should wrap when the form is submitted:

var x = document.getElementById("myTextarea").wrap;

Try it yourself

Syntax

Return the wrap attribute:

textareaObject.wrap

Set the wrap attribute:

textareaObject.wrap = soft|hard

Attribute value

Value Description
soft When submitted in a form, the text in the text area does not wrap. Default.
hard

When submitted in a form, the text in the text area will be wrapped (including newline characters).

Tip:When using "hard", it is necessary to specify cols Attribute.

Technical Details

Return Value: A string value that indicates how the text area is wrapped when submitted in a form.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support