We can create a <textarea> element via the document.createElement()
method:
var x = document.createElement("TEXTAREA");
Click the button to create a TEXTAREA element.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {//from w w w. j av a 2s .c om var x = document.createElement("TEXTAREA"); var t = document.createTextNode("At java2s.com you will learn how to make a website."); x.appendChild(t); document.body.appendChild(x); } </script> </body> </html>