Web4College

HTML textarea tag

HTML <textarea> tag defines multi-line textarea having height and width as rows and columns. We can apply different attributes on textarea to make it more usable.

Example
Try it
<textarea cols="25" rows="9">
  It is textarea. It is editable and resizeable by default.But the size  can be fixed. 
</textarea>

Tag omission

Both starting and ending tags are necessary for the textarea element.

Global Attributes

All the global attributes are applicable on the textarea element.

Tag Attributes

Attributes that are applicable to <textarea> tag
autocomplete

browser suggests different options to the user for form autocomplete.

Example
Try it
<textarea autocomplete> the content goes here </textarea>
autofocus

automatically focus the control to the specified input field after page loading.

Example
Try it
<textarea autocomplete> the autofocus attribute is here </textarea>
cols

represents the width (no of characters per line) of the textarea.

Example
Try it
<textarea cols="an integer"> the cols attribute is here </textarea>
disabled

It makes the input field uneditable and unprocessable.

Example
Try it
<textarea disabled> the disabled textarea </textarea>
form

represents form to collect the information.

Example
Try it
<textarea form="id of the form element"> the plain text </textarea>
maxlength

It specifies the maximun value in the input field.

Example
Try it
<textarea maxlength="an integer"> maximum number of characters </textarea>
minlength

It specifies the minimum value in the input field.

Example
Try it
<textarea minlength="an integer"> minimum number of characters </textarea>
name

It specifies a unique name to use for submission with form.

Example
Try it
<textarea name="text"> unique name of textarea </textarea>
placeholder

It places the user-visible content in the input field.

Example
Try it
<textarea placeholder="text"> water mark type text </textarea>
readonly

The content inside input field can be read only.

Example
Try it
<textarea readonly> Here you can not edit </textarea>
required

forces the user to put value in input field.

Example
Try it
<textarea required> You must enter the text here </textarea>
rows

represents the height (no of lines) of the textarea.

Example
Try it
<textarea rows="integeral value"> no of lines to show </textarea>