Get the contents of a text area:
var x = document.getElementById("myTextarea").value;
Click the button to alert the contents of the text area.
<!DOCTYPE html> <html> <body> Address:<br> <textarea id="myTextarea"> PO 1234, Main Street U.S.A. New York</textarea> <button type="button" onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*w ww .j a v a 2 s. c o m*/ var x = document.getElementById("myTextarea").value; document.getElementById("demo").innerHTML = x; } </script> </body> </html>