//html
<textarea name="text" oninput="auto_grow(this)"></textarea>
//js
<script>
function auto_grow(element) {
element.style.height = "auto";
element.style.height = (element.scrollHeight)+"px";
};
const x = document.querySelector('#textarea-input')
x.onsubmit = (event) => {
messageBox.style.height = 'auto';}
</script>