estoy usando CKEditor para mi editor WYSIWYG y tengo que controlar y limitar el recuento de caracteres, ya que están escribiendo Tengo un script de jQuery que funciona bien para un TextArea normalesLimitar/Count Caracteres en CKEditor w/Jquery
<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>
Sin embargo, esto no parece funcionar para cuando el campo textArea se reemplaza con el CKEditor alguna idea?
¿Me ayudó la respuesta de mi o @ Pekka? – sestocker
La respuesta de todos desafortunadamente solo puedo marcar una ... suspiro muchas gracias – dswatik