Javascript examples for DOM HTML Element:Textarea
Holding DOM elements in variables
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w w w . ja v a2 s. c o m*/ var textarea = document.getElementById("myTextarea"); var words = textarea.value; var button = document.getElementById("myButton"); button.addEventListener("click", function() { console.log(words); }); } </script> </head> <body> Enter here <input id="myTextarea"> <button id="myButton" type="submit"> test </button> </body> </html>