10월 22일 서버 점검 안내 (00:00~06:00)
대

댓글 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개

유용한 정보 감사드립니다.
감사합니다~~
댓글을 작성하시려면 로그인이 필요합니다.
+
제목 글쓴이 날짜 조회
19-09-18 조회 1만
19-09-15 조회 1만
19-09-15 조회 1.2만
19-09-13 조회 7,336
19-09-11 조회 9,579
19-09-09 조회 9,239
19-09-04 조회 9,275
19-09-02 조회 7,653
19-09-01 조회 8,834
19-08-30 조회 8,794
19-08-30 조회 1.3만
19-08-30 조회 7,950
19-08-29 조회 9,992
19-08-28 조회 9,001
19-08-26 조회 7,641
19-08-26 조회 6,767
19-08-25 조회 7,066
19-08-25 조회 6,927
19-08-22 조회 8,251
19-08-19 조회 8,521
19-08-16 조회 9,918
19-08-12 조회 7,197
19-08-10 조회 7,004
19-08-09 조회 7,056
19-08-09 조회 9,814
19-08-09 조회 1.1만
19-08-06 조회 6,989
19-08-05 조회 1.6만
19-08-05 조회 8,558
19-08-04 조회 8,173