Change the width and height of a text area using the style.width and style.height properties:
Click the button to change the width and height of the text area.
<!DOCTYPE html> <html> <body> <textarea id="myTextarea"> At java2s.com you will learn how to make a website. </textarea> <button type="button" onclick="myFunction()">Test</button> <script> function myFunction() {//ww w . j ava 2s . co m document.getElementById("myTextarea").style.height = "100px"; document.getElementById("myTextarea").style.width = "500px"; } </script> </body> </html>