Get the height of a text area, in characters:
var x = document.getElementById("myTextarea").rows;
Click the button to display the value of the rows attribute of the text area.
<!DOCTYPE html> <html> <body> <textarea id="myTextarea" rows="4" cols="50"> At java2s.com you will learn how to make a website. </textarea> <button type="button" onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w ww .ja v a 2 s.co m*/ var x = document.getElementById("myTextarea").rows; document.getElementById("demo").innerHTML = x; } </script> </body> </html>