textarea 높이 질문
본문
textarea에 입력할때 처음 높이보다 내용이 많으면 스크롤이 생기는데
이걸 입력하는 양에 따라서 자동으로 높이가 커지게 가능한가요?
답변 1
$(document).on('input','textarea',function () {
var $this = $(this);
if(!this.org_h){
this.org_h = $this.outerHeight();
}
if(this.scrollHeight<this.org_h){
return true;
}
this.style.height = 'auto';
this.style.height = (this.scrollHeight) + 'px';
})
답변을 작성하시기 전에 로그인 해주세요.