How to fix manually resized textarea programatically

You need to set height to auto. Try below code-

function resizeMe(){
document.querySelector('textarea').rows = "10";
document.querySelector('textarea').style.height = "auto";
}
<textarea rows="4" cols="50">
At w3schools.com you will learn how to make a website. We offer free tutorials in all web development technologies.
</textarea>

<button onclick="resizeMe()">Resize Me</button>