댓글 textarea 자동 높이조절 입니다

<script type="text/javascript">
function autoTextarea(obj,limit) {
        obj.style.height = "1px";
        if (limit >= obj.scrollHeight) obj.style.height = (20+obj.scrollHeight)+"px";
        else obj.style.height = (20+limit)+"px";
}
</script>

요기까지 상단에 넣으시고

 

textarea 부분에서

 <?php if ($comment_min || $comment_max) { ?><strong id="char_cnt"><span id="char_count"></span>글자</strong><?php } ?>
                <textarea  onkeyup="autoTextarea(this,100);" class=nbbs id="wr_content" name="wr_content"  rows="5" maxlength="10000" required title="내용"
                <?php if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?> style='width:100%; word-break:break-all;' class=tx><?php echo $c_wr_content;  ?></textarea>
                <?php if ($comment_min || $comment_max) { ?><script> check_byte('wr_content', 'char_count'); </script><?php } ?>
                <script>
                $(document).on( "keyup change", "textarea#wr_content[maxlength]", function(){
                    var str = $(this).val()
                    var mx = parseInt($(this).attr("maxlength"))
                    if (str.length > mx) {
                        $(this).val(str.substr(0, mx));
                        return false;
                    }
                });
                </script>

요걸 넣으시면 됩니다.

|

댓글 2개

유용한 정보 감사드립니다.
감사합니다~~
댓글을 작성하시려면 로그인이 필요합니다.

그누보드5 팁자료실

+
제목 글쓴이 날짜 조회
6년 전 조회 4,147
6년 전 조회 6,386
6년 전 조회 6,140
6년 전 조회 6,320
6년 전 조회 4,771
6년 전 조회 5,865
6년 전 조회 5,860
6년 전 조회 9,634
6년 전 조회 5,023
6년 전 조회 6,913
6년 전 조회 6,047
6년 전 조회 4,730
6년 전 조회 3,909
6년 전 조회 4,146
6년 전 조회 3,996
6년 전 조회 5,263
6년 전 조회 5,469
6년 전 조회 6,951
6년 전 조회 4,260
6년 전 조회 3,893
6년 전 조회 4,141
6년 전 조회 6,744
6년 전 조회 8,180
6년 전 조회 4,008
6년 전 조회 1.2만
6년 전 조회 5,580
6년 전 조회 5,190
6년 전 조회 5,729
6년 전 조회 3,968
6년 전 조회 6,545