HTML 페이지 textarea 에 데이타 입력할 경우

 

키업 이벤트 발생할때 마다 입력된 내용의 높이 ( 스크롤바 )를 읽어서 textarea 의 높이를 변경해 준다.

 

jQuery("textarea").on(
    "keyup", function(){

        console.log( "this.id => " + this.id );

        switch (this.id)
        {
            case "prod01_work_memo":
                jQuery( this ).css('height', 'auto');
                console.log( jQuery( this ).prop('scrollHeight') );
                jQuery( this ).css('height', jQuery( this ).prop('scrollHeight'));
                break;
        }// end switch
    }
);