<textarea>



HTML <textarea> Tag


The <textarea> tag specifies a multi-line plain-text editing control.


Syntax :

<textarea></textarea>

Example :

<textarea  name="address" rows="5" cols="50" placeholder="Enter address.."></textarea>

Output :


Attribute of <textarea> Tag


Attribute Value Description
autofocus - Specifies that a textarea should automatically get focus when the page loads.
autocomplete
  • on
  • off
Specifies whether the value of the <textarea> element can be automatically completed by the browser.
cols number Specifies the character width of the text area.
dirname form_id Specifies that the text direction of the textarea will be submitted
disabled - Specifies that a textarea should be disabled.
form form_id Specifies that one or more textarea outside the forms tag belongs to it.
maxlength number Specifies the maximum character length of the text area
name text Specifies a name for a textarea.
placeholder text Specifies a short description about what this textarea is for.
readonly - Specifies that the user cannot modify the value in the textarea.
required - Specifies that a text area is required and needs to be populate
rows number Specifies the character height of the text area.
wrap
  • hard
  • soft
  • off
Specifies how the text area is wrapped on form submission.

Example of Attributes


1. autofocus


Example :

<textarea rows="5" cols="50" autofocus></textarea>

2. cols


Example :

<textarea rows="5" cols="50"></textarea>

3. dirname

 


Example : 

<textarea rows="5" cols="50" dirname="demoText"></textarea>

4. disabled


Example : 

<textarea rows="5" cols="50" disabled></textarea>

5. form


Example : 

<textarea rows="5" cols="50" form="demoForm"></textarea>

6. maxlength


Example : 

<textarea rows="5" cols="50" maxlength="50"></textarea>

7. name


Example : 

<textarea rows="5" cols="50" name="textareaName"></textarea>

8. placeholder


Example : 

<textarea rows="5" cols="50" placeholder="short description"></textarea>

9. readonly


Example : 

<textarea rows="5" cols="50" readonly></textarea>

10. required


Example : 

<textarea rows="5" cols="50" required></textarea>

11. row


Example : 

<textarea rows="5"  cols="50"></textarea>

12. wrap


Example : 

<textarea rows="5" cols="50" wrap="hard"></textarea>