Get textarea value and use button for accepting input - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Textarea

Description

Get textarea value and use button for accepting input

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script>
function getText() {//from  w  w  w.j a  v a 2 s  .  c  om
    var str=document.getElementById("txtArea").value;
      document.getElementById('output').innerHTML +=str + " i did it";
 }
 
      </script> 
   </head> 
   <body> 
      <textarea rows="5" cols="30" id="txtArea"> </textarea> 
      <input type="button" value="click here" onclick="getText();"> 
      <div id="output"></div>  
   </body>
</html>

Related Tutorials