O'Reilly logo

HTML5 Data and Services Cookbook by Mite Mitreski, Gorgi Kosev

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using textarea

In this recipe we will take a look at the textarea element and create a simple form to show some of the attributes that can be used. textarea is intended for use as a multiple line plain-text editing control.

How to do it...

We will create an example form to demonstrate some of the uses of the textarea element:

  1. First we add a texarea element with the placeholder attribute set:
    <form>
      <label>Short info: <textarea placeholder="some default text"></textarea>
      </label>
  2. Then we add a textarea with the rows and cols attributes set:
    <label>
      Info with default size set: <textarea  rows="4" cols="15" placeholder="some default text"></textarea>
    </label>
  3. Then we add one with maxlength set:
      <label>
        Max area limited to 5 characters <textarea maxlength="5" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required