What is the utility of the wrap
attribute of the textarea
tag?
What's the difference between your soft, hard, off
values?
What is the utility of the wrap
attribute of the textarea
tag?
What's the difference between your soft, hard, off
values?
Just to complement the other response, as per the documentation for MDN
Indicates how text wrapping should work in <textarea>
cols
must be specific. wrap=""
) The browser ensures that all line breaks in value consist of a pair (CR + LF) insert any additional line breaks when the form is submitted. According to the w3.org are of the values ( soft and hard) are new HTML5 features, even if it works in some older browsers, it might not be standard .
Note:
- Carriage return (CR, 0x0D, \ r) moves the cursor to the beginning of the line without advancing to the next line. This character is used as a newline character in the Commodore and Early Machintosh operating systems (OS-9 and older).
- Line feed (LF, 0x0A, \ n) moves the cursor to the next line without returning to the beginning of the line. This character is used as a newline character on UNIX-based systems (Linux, Mac OSX, etc.)
Source: link
The wrap attribute specifies how the text in the textarea element is to be adjusted when a form is submitted.
Soft : The text in the element is not adjusted when it is submitted in a form. This is the default value.
Hard : The text in the element is adjusted (containing new rows) when it is submitted in a form. When hard
is used, the cols
attribute must be specified.
EDIT
This makes it a great way to give users an example or description of how to proceed to fill in the text area field. Something like, "Please limit your answer to 100 characters," would be an ideal description.
References: