I want to create a textarea
which is preloaded with content. Its height should be auto
when content is there but when it's empty the height should become 4.2rem
. When I enter text in it should increase and decrease the height to a maximum height of 7.7rem
using jQuery.
How can I do 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>