Textarea name Property

Textarea Object Reference Textarea Object

Example

Get the name of a text area:

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

The result of x will be:

comment

Try it yourself »

Definition and Usage

The name property sets or returns the value of the name attribute of a text area.

The name attribute is used to reference elements in a JavaScript, or to reference form data after a form is submitted.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The name property is supported in all major browsers.


Syntax

Return the name property:

textareaObject.name

Set the name property:

textareaObject.name=text

Property Values

Value Description
text Specifies the name of the text area

Technical Details

Return Value: A String, representing the name of the text area

More Examples

Example

Change the name of a text area:

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

Try it yourself »

Related Pages

HTML reference: HTML <textarea> name attribute


Textarea Object Reference Textarea Object

SHARE THIS PAGE

COLOR PICKER

colorpicker





Search w3schools.com:

Translate w3schools.com: