I really need character counting in FCKEditor (not just for displaying). I'm now using FCK 2.0 b2, and cannot figure it out.
Something like (works with textarea):
var length = document.getElementById('myTextarea').value.length;
var price = length * 0.6;
...an so on
Something like (works with textarea):
var length = document.getElementById('myTextarea').value.length;
var price = length * 0.6;
...an so on
RE: I really need character counting - help p
I tested this a time ago, but I make a stupid mistake. I called function in a button's 'onclick' and forgotten to 'return false;' in it. So the page always reloaded it's content. So be careful.
code:
var edApi = FCKeditorAPI.GetInstance('Fckeditor1');
var text = edApi.GetHTML();
var length = text.length;
// here you must remove all HTML tags and trim all leading and trailing spaces
var price = length * 0.6;
...