Textarea name attribute

Definition and Usage

name Set or return the value of the text area's name attribute.

The HTML name attribute is used to reference elements in JavaScript, or to reference form data after submitting the form.

See also:

HTML Reference Manual:HTML <textarea> name Attribute

Instance

Example 1

Get the name of the text area:

var x = document.getElementById("myTextarea").name;

Try It Yourself

Example 2

Change the name of the text area:

document.getElementById("myTextarea").name = "newTxtName";

Try It Yourself

Syntax

Return name attribute:

textareaObject.name

Set name attribute:

textareaObject.name = text

Attribute Value

Value Description
text Specifies the name of the text area.

Technical Details

Return Value: A string value that represents the name of the text area.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support