Limiting length of text and including character count
How can I limit the length of text, including xhtml markup, that a user can enter? I'd also love to have a character count, again including xhtml markup.
Yavin thanks for the Post but after attaching a listener to the "key" event (CKEDITOR.instances.editor1.on("key", function (event)) I find its buggy. The event does not fire properly.
CKEDITOR.instances.txtEditor.on("key", function() {
var txt= CKEDITOR.instances.txtEditor.getData();
alert(txt);
})
In the above example the text in the document is not properly shown. Is there any other solution or am I doing anything wrong?
When you use the getData function, you are getting everything including tags and spacing. The .length property of a javascript string yields the character count including empty spaces. So there is really nothing wrong because it does not count newlines or anything like that, you should only be dealing with the code tags etc.
Re: Limiting length of text and including character count
You can retrieve all the data into a string on the javascript side:
Re: Limiting length of text and including character count
In the above example the text in the document is not properly shown. Is there any other solution or am I doing anything wrong?
Re: Limiting length of text and including character count