Tutorials Point

  HTML Home

  HTML Tags Reference
  Selected Reading

Copyright © 2014 by tutorialspoint

  Home     References     Discussion Forums     About TP  

HTML <textarea> tag



The HTML <textarea> tag is used within a form to declare a textarea element - a control that allows the user to input text over multiple rows.

Difference between HTML and XHTML:



<form action="/cgi-bin/hello_get.cgi" method="get">
Description : <br />
<textarea rows="5" cols="50" name="description">
Enter description here...
<input type="submit" value="submit" />

This will produce following result:

Description :

Online Practice:

To Become more comfortable - Do Online Practice


colsnumberSpecifies the width of the textarea based on the number of visible character widths.
disableddisabledDisables the input control. The button won't accept changes from the user. It also cannot receive focus and will be skipped when tabbing.
namefiled nameAssigns a name to the input control.
readonlyreadonlySets the input control to read-only. It won't allow the user to change the value. The control however, can receive focus and are included when tabbing through the form controls.
rowsnumberSpecifies the height of the textarea based on the number of visible lines of text. If there's more text than this allows, users can scroll using the textarea's scrollbars.

Standard Attributes:

classDocument wide identifier
dirSpecifies the direction of the text
idDocument wide identifier
titleSpecifies a title to associate with the element.
styleHelps to include inline casecadubf style sheet.
langSets the language code.
xml:langSets the language code.
tabindexHelps determine the tabbing order
accesskeyAccess keys (or shortcut keys)

Event Attributes:

onfocusScript runs when control gets focus
onblurScript runs when control loses focus
onselectScript runs when the element is selected
onchangeScript runs when the element changes
onclickScript runs when a mouse click
ondblclickScript runs when a mouse double-click
onmousedownScript runs when mouse button is pressed
onmouseupScript runs when mouse button is released
onmouseoverScript runs when mouse pointer moves over an element
onmousemoveScript runs when mouse pointer moves
onmouseoutScript runs when mouse pointer moves out of an element
onkeypressScript runs when key is pressed and released
onkeydownScript runs when key is pressed
onkeyupScript runs when key is released

Printer Friendly