HTML - attributes - wrap

revision:


Content

"wrap" attribute : specifies how text is wrapped in textarea syntax some examples


"wrap" attribute : specifies how text is wrapped in textarea

top

The wrap attribute specifies how the text in a text area is to be wrapped when submitted in a form. The wrap attribute can be applied on the following HTML element: <textarea>.


syntax

top

<textarea wrap="soft|hard"></textarea>

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


some examples

top
codes:
                    <form style="margin-left:3vw;" action="/action_page.php">
                        <textarea rows="3" cols="20" name="usrtxt" wrap="hard">In various places on my website you will 
                        find free Web-building tutorials.
                        <input type="submit">
                    </form>
                

codes:
                    <textarea style="margin-left:3vw;" id="myId"  rows="3" cols="20" name="newText" wrap="soft">
                    This text is wrapped in the text area field.</textarea>                               
                    <br>
                    <button style="margin-left:3vw;" onclick="submitText()">Submit</button>