P粉7859577292023-09-05 15:42:29
You need to write a small script to do this job. Please see the following code:
const textArea = document.querySelector('.textarea-test') textArea.addEventListener('input',(e)=>{ textArea.style.height = "auto" textArea.style.height = `${textArea.scrollHeight}px`; })
<textarea name="" id="" cols="30" rows="4" class="textarea-test"></textarea>