Javascript examples for DOM HTML Element:Textarea
Textarea name Property - Change the name of a text area:
<!DOCTYPE html> <html> <body> <textarea id="myTextarea" name="comment"> Some text in a text area....</textarea> <button onclick="display()">Display name</button> <button onclick="change()">Change name</button> <script> function display() { var x = document.getElementById("myTextarea").name; console.log("The name of the text area is: " + x); } function change() {/*from www . j av a 2 s . co m*/ var x = document.getElementById("myTextarea").name = "newTxtName"; console.log("The name was changed to: " + x); } </script> </body> </html>