Latest web development tutorials
 

Textarea name Property

< 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