JSFiddle - React, Tailwind, and code Playground
by marhaba
HTML
<textarea class="expand" rows="1" cols="10"></textarea>
CSS
.expand {
height: 1em;
width: 50%;
padding: 3px;
}
JavaScript
$(function(){
var textareasize = $('.expand').css('height');
alert(textareasize);
$('textarea.expand').focus(function () {
$(this).animate({ height: "4em" }, 500);
});
$('textarea.expand').blur(function () {
$(this).animate({ height: textareasize }, 500);
});
});