Javascript DOM HTML Textarea rows Property set using CSS style

Introduction

Change the height of a text area using the style.height property:

document.getElementById("myTextarea").style.height = "250px";

Click the button to change the height of the text area.

View in separate window

<!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>

<p id="demo"></p>

<script>
function myFunction() {//from w  ww .jav  a 2 s . com
  document.getElementById("myTextarea").style.height = "250px";
}
</script>

</body>
</html>



PreviousNext

Related