Textarea

A textarea is a multiline box into which text can be typed. Its HTML looks like this:

<textarea rows = "10" cols = "40">some default text</textarea>.

Properties

cols

FF, IE 4

Number of columns of the textarea

defaultValue

FF, IE 3

Read-only: Browser-set default value for the element

form

FF, IE 3

Read-only: Form containing the element

maxLength

FF, IE 4

Maximum number of characters allowed in the field

name

FF, IE 3

Name of the textarea field

readOnly

FF, IE 4

true if users can't enter data into the field

rows

FF, IE 4

Number of rows of this textarea

type

FF, IE 4

Read-only: Set to "TEXTAREA"

value

FF, IE 3

Text that appears in the textarea

Methods

blur()

FF, IE 3

Removes the cursor from the textarea

Example:

window.document.my_form.the_area.blur();

focus()

FF, IE 3

Moves ...

Get The Book of JavaScript, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.