Textarea name Property
Example
Get the name of a text area:
var x = document.getElementById("myTextarea").name;
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
| Property | |||||
|---|---|---|---|---|---|
| name | Yes | Yes | Yes | Yes | Yes |
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
