Latest web development tutorials
 

Textarea wrap Property

< Textarea Object

Example

Find out how the text in a text area should be wrapped when submitting a form:

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

The result of x will be:

hard // the text in the text area will contain newlines (if any) when submitted in a form
Try it Yourself »

Definition and Usage

The wrap property sets or returns the value of the wrap attribute of a text area.

The wrap attribute specifies how the text in a text area is to be wrapped when submitted in a form.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The wrap property is supported in all major browsers.


Syntax

Return the wrap property:

textareaObject.wrap

Set the wrap property:

textareaObject.wrap=soft|hard

Property Values

Value Description
soft The text in the text area is not wrapped when submitted in a form. This is default
hard The text in the text area is wrapped (contains newlines) when submitted in a form. When "hard" is used, the cols attribute must be specified

Technical Details

Return Value: A String, representing how the text area wraps text when submitted in a form

Related Pages

HTML reference: HTML <textarea> wrap attribute


< Textarea Object