Textarea의 높이를 입력에 맞춰서 자동으로 변경하고 싶을 때는 아래와 같이 할 수 있습니다.
.auto-height {
width: 100%;
}
.auto-height textarea {
width: 100%;
resize: none;
overflow-y: hidden;
padding: 15px 15px 5px;
line-height: 1.5;
}
<div class="form-group auto-height">
<label for="memo">메모</label>
<textarea class="form-control" id="memo" name="memo"></textarea>
</div>
$(document).ready(function() {
$('.auto-height').on('keyup', 'textarea', function (){
$(this).css('height', 'auto');
$(this).height( this.scrollHeight );
});
$('.auto-height').find('textarea').keyup();
});