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.

<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.

<textarea autocomplete> the content goes here </textarea>
autofocus

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

<textarea autocomplete> the autofocus attribute is here </textarea>
cols

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

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

It makes the input field uneditable and unprocessable.

<textarea disabled> the disabled textarea </textarea>
form

represents form to collect the information.

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

It specifies the maximun value in the input field.

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

It specifies the minimum value in the input field.

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

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

<textarea name="text"> unique name of textarea </textarea>
placeholder

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

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

The content inside input field can be read only.

<textarea readonly> Here you can not edit </textarea>
required

forces the user to put value in input field.

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

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

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


Was this article helpful?