wr_content 글자수
본문
글자수 제한 실시간 체크하기 위해
1.에디터 사용안함으로 했구요
2.아래 코드를
<tr>
<th scope="row"><label for="wr_content">내용<strong class="sound_only">필수</strong></label></th>
<td class="wr_content">
<?php if($write_min || $write_max) { ?>
<!-- 최소/최대 글자 수 사용 시 -->
<p id="char_count_desc">이 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 이상, 최대 <strong><?php echo $write_max; ?></strong>글자 이하까지 글을 쓰실 수 있습니다.</p>
<?php } ?>
<?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
<?php if($write_min || $write_max) { ?>
<!-- 최소/최대 글자 수 사용 시 -->
<div id="char_count_wrap"><span id="char_count"></span>글자</div>
<?php } ?>
</td>
</tr>
대신 다음으로 바꾸려는데...
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
$('#content').keyup(function (e){
var content = $(this).val();
$(this).height(((content.split('\n').length + 1) * 1.5) + 'em');
$('#counter').html(content.length + '/10');
});
$('#content').keyup();
});
</script>
<style>
.wrap {
width: 300px;
height: auto;
position: relative;
display: inline-block;
}
.wrap textarea {
width: 100%;
resize: none;
min-height: 4.5em;
line-height:1.6em;
max-height: 9em;
}
.wrap span {
position: absolute;
bottom: 5px;
right: 5px;
}
#counter {
background:rgba(255,0,0,0.5);
border-radius: 0.5em;
padding: 0 .5em 0 .5em;
font-size: 0.75em;
}
</style>
<div class="wrap">
<textarea id="content" maxlength="10"></textarea>
<span id="counter">###</span>
</div>
어떻게 해야 할까요?
<textarea id="content" maxlength="10"></textarea> 이부분에 wr_content를 넣어주어야 할거 같은데...