I am looking to create a textarea
that comes preloaded with content. The height of the textarea should adjust to auto
when there is content present, but switch to a height of 4.2rem
when it is empty. Additionally, I want the textarea to dynamically increase and decrease in height as text is entered, with a maximum height of 7.7rem
using jQuery.
Any suggestions on how to achieve this?
.textAreaGrow {
padding: 1.8rem 0 .8rem;
height: 4.2rem;
max-height: 7.7rem;
}
<textarea class="textAreaGrow">Lorem ipsum, or lipsum as it is sometimes known, is dummy text used in laying out print, graphic or web designs.</textarea>