HTML <textarea> tag
- closing tag
- required
- void element
- no
- lives inside
- <form>
- typically holds
- the default text, if any (usually empty)
Where it goes
Inside a <form>, with a <label> like any other field. rows sets how many lines tall it starts.
Example
<label for="msg">Message</label>
<textarea id="msg" name="message" rows="4"></textarea>Open this example in the editor →
Common mistakes
- Giving it a value attribute like <input>. It has none. Its starting text goes between the opening and closing tags.
- Writing it self-closed, like <textarea />. It needs a real closing tag. Without one, the browser swallows the rest of the page into the box.
- Forgetting name. Like <input>, without it whatever the visitor types is never sent.