댓글 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,094
6년 전 조회 6,318
6년 전 조회 6,074
6년 전 조회 6,243
6년 전 조회 4,717
6년 전 조회 5,785
6년 전 조회 5,780
6년 전 조회 9,566
6년 전 조회 4,976
6년 전 조회 6,827
6년 전 조회 5,976
6년 전 조회 4,670
6년 전 조회 3,860
6년 전 조회 4,085
6년 전 조회 3,931
6년 전 조회 5,195
6년 전 조회 5,404
6년 전 조회 6,870
6년 전 조회 4,198
6년 전 조회 3,820
6년 전 조회 4,078
6년 전 조회 6,661
6년 전 조회 8,113
6년 전 조회 3,953
6년 전 조회 1.2만
6년 전 조회 5,503
6년 전 조회 5,129
6년 전 조회 5,658
6년 전 조회 3,887
6년 전 조회 6,481