The simplest solution:
html:
<textarea class="auto-expand"></textarea>
css:
.auto-expand {
overflow:hidden;
min-height: 80px;
}
js (jquery):
$(document).ready(function () {
$("textarea.auto-expand").focus(function () {
var $minHeight = $(this).css('min-height');
$(this).on('input', function (e) {
$(this).css('height', $minHeight);
var $newHeight = $(this)[0].scrollHeight;
$(this).css('height', $newHeight);
});
});
});