Change TextArea

HTML

<textarea id="text" rows="4" cols="50">
At w3schools.com you will learn how to make a website. We offer free tutorials in all web development technologies. Right now, the rows is set to 4 and you will be able to change them to either 2 or 7 by pressing the appropriate buttons
</textarea>
<br />
<button id="change2" onClick="changeRows2()" type="button">Change Rows to 2</button>
<button id="change7" onClick="changeRows7()" type="button">Change Rows to 7</button>
<button id = "change8" onClick="changeText()" type="button">Change Text</button>

JavaScript

changeRows2 = function(){
    document.getElementById('text').rows = 2;
}
    
changeRows7 = function(){
    document.getElementById('text').rows = 7;
}

changeText = function(){
    document.getElementById('text').remove();
    document.getElementById('text').val('hey there');
}