From http://www.w3schools.com (Copyright Refsnes Data)

HTML 5 <textarea> tag


Definition and Usage

Defines a text-area (a multi-line text input control). A user can write text in the text-area. In a text-area you can write an unlimited number of characters. The default font in the text-area is fixed pitch.


Differences Between HTML 4.01 and HTML 5

HTML 5 has some new attributes, and some HTML 4.01 attributes are no longer supported.


Example

Source Output
<textarea rows="2" cols="20">
The cat was playing in the garden. Suddenly a dog showed up.....
</textarea>


Attributes

Attribute Value Description 4 5
autofocus true
false
Makes the textarea focused on page load   5
cols number Specifies the number of columns visible in the text-area 4 5
disabled true
false
Disables the text-area when it is first displayed 4 5
form true
false
Defines one ore more forms the textarea belongs to.   5
inputmode inputmode Defines what kind of input in the textarea to expect   5
name name_of_textarea Specifies a name for the text-area 4 5
readonly true
false
Indicates that the user cannot modify the content in the text-area 4 5
required true
false
Defines if the textarea's value is required in order to submit the form.   5
rows number Specifies the number of rows visible in the text-area 4 5

Standard Attributes

class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title

For a full description, go to Standard Attributes in HTML 5.

Event Attributes

onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup, onload, onmessage, onmousedown, onmousemove, onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect, onsubmit, onunload

For a full description, go to Event Attributes in HTML 5.


Try-It-Yourself Demos

Textarea
How to create a text-area.


From http://www.w3schools.com (Copyright Refsnes Data)