everyone, I am not familiar with javascript. I would like to ask you a question! I have a message block. The default block height is to retain the input height of 1 row. The height of the textarea will increase as more text is input. the maximum height is 3 row, I currently write directly textarea above
oninput = "this.style.height = '';
this.style.height = Math.min (this.scrollHeight -3, 67) + 'px'"
is It can be achieved, but the question arises how to restore the height to the original height of 1 row after pressing send?
.demo{
resize:none;
max-height:120px;
}
<div id="app">
<textarea oninput="this.style.height='';
this.style.height = Math.min(this.scrollHeight -3 ,67)+'px'" class="demo">
</textarea>
<br>
<input type="button" value="SEND">
</div>