HTML Tutorial - HTML Form textarea








The textarea element creates a multiline text box.

It has local Attributes:name, disabled, form, readonly, maxlength, autofocus, required, placeholder, dirname, rows, wrap, cols.

The text contents are wrapped between the start and end tags.

The form, autofocus, required, placeholder, and wrap attributes are new in HTML5.

The rows and cols attributes specify the dimensions of the textarea.

The hard or soft value for wrap attribute control how line breaks are added to the text.

The following code shows the textarea element in use.

<!DOCTYPE HTML>
<html>
<body>
  <form method="post" action="http://example.com/form">
    <p>
      <textarea cols="20" rows="5" wrap="hard" id="story" name="story">
      Say something<!--from  w  w  w  .  ja v a2 s .  co m-->
      </textarea>
      <input type="submit" value="Submit" />
    </p>
  </form>
</body>
</html>

Click to view the demo

The wrap attribute controls how line breaks are inserted into the text when the form is submitted.