I am using CKEditor for my wysiwyg editor and I need to monitor and limit the character count as they are typing I have a jquery script that works fine for a normal TextArea
<script type ="text/javascript" language="javascript">
function limitChars(textid, limit, infodiv) {
var text = $('.' + textid).val();
var textlength = text.length;
if (textlength > limit) {
$('#' + infodiv).html('You cannot write more then ' + limit + ' characters!');
$('#' + textid).val(text.substr(0, limit));
return false;
}
else {
$('#' + infodiv).html('You have ' + (limit - textlength) + ' characters left.');
return true;
}
}
$(function() {
$('.comment-1').keyup(function() {
limitChars('comment-1', 1000, 'charlimitinfo-1');
})
});
</script>
However this doesn't seem to work for when the textArea is replaced with the CKEditor any ideas?