Name

WRAP — NN 2 IE 4 HTML n/a

Synopsis

WRAP=”wrapType"

Required

The WRAP attribute tells the browser whether it should wrap text in a TEXTAREA element and whether wrapped text should be submitted to the server with soft returns converted to hard carriage returns. Navigator and Internet Explorer don’t agree fully on the possible values, and the HTML specification is silent on the subject. Even so, there are cross-browser solutions.

If WRAP is turned off (the default), the TEXTAREA element activates the horizontal scrollbar as characters exceed the original column width. A press of the Return/Enter key causes the cursor to advance to the next line back at the left margin. To submit the content without the word-wrapped soft returns converted to hard carriage returns (in other words, submitted as typed), set the WRAP attribute by including the attribute like a Boolean value. To convert the soft returns to hard carriage returns (and thus preserving the word-wrapped formatting in the submitted content), set the value of WRAP to hard. Both Navigator and Internet Explorer recognize this setting, whereas Navigator does not recognize IE’s value of physical.

Example

<TEXTAREA NAME="comments" WRAP></TEXTAREA>

Value

The presence of the WRAP attribute (without any assigned value) engages word wrapping (and filters soft returns before being submitted). A value of hard also engages word wrapping and converts soft returns to CR-LF characters in the value submitted to the server. A value of off or no ...

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.