Default text is element content, and cols is not maxlength
<textarea name rows cols maxlength>
default text
</textarea>The initial text lives inside the element. cols sizes the visible width; maxlength limits the value length.
| Attribute | Description |
|---|---|
name | The field name used in form submission. |
rows | Visible height in text rows. The default is 2. It is not a maximum number of characters or lines in the value. |
cols | Visible width in average character widths. The default is 20. It is not a substitute for maxlength. |
maxlength | Maximum length of the value, in UTF-16 code units as specified for the constraint. It does not change the visible cols width. |
minlength | Minimum length of the value when the user has entered something. Unused in this example. |
placeholder | A hint shown when the value is empty. It is not a label and is not submitted. |
wrap | soft is the default and does not insert line breaks into the submitted value. hard can insert line breaks in the submitted value and requires cols. Submission was not tested here. |
- No value attribute is present. The default wording is element content. Nothing is submitted from this page.
<form>
<label for="bio">Short bio</label>
<textarea id="bio" name="bio" rows="4" cols="40" maxlength="200" placeholder="One or two sentences">Default text lives in the element, not in a value attribute.</textarea>
</form>What this markup means
The textarea has no value attribute. Its default text is the character data inside the element. cols="40" only suggests a visible width of about forty characters, while maxlength="200" is a separate limit on the value. placeholder would appear only if that content were cleared. The form has no remote action.
Related: Tag catalog: <textarea>, <form>, <input>, <label>