Javascript examples for DOM HTML Element:Textarea
The rows property sets or gets the rows attribute of a text area, which sets the visible number of lines in a text area.
Set the rows property with the following Values
Value | Description |
---|---|
number | Sets the visible number of rows in the text area |
A Number, representing the height of the text area, in characters
The following code shows how to change the number of visible rows for a text area:
<!DOCTYPE html> <html> <body> <textarea id="myTextarea" rows="4" cols="50"> new value/* w w w. ja v a 2 s . c o m*/ </textarea> <button type="button" onclick="myFunction()">Test</button> <script> function myFunction() { document.getElementById("myTextarea").rows = "10"; } </script> </body> </html>