I am using TinyMCE for . My requirement is to limit the character size to 2000 and also to show the remaining characters somewhere below the tool ba
I had the same issue and found this link very useful: http://www.ryann.ca/?p=186
Although I changed this slightly so that it reads the attribute of maxlength direct from the textarea.
tinyMCE.init({
// Options
setup : function(ed) {
ed.onKeyUp.add(function(ed, e) {
var tinylen, htmlcount, maxlength = $("#" + tinyMCE.activeEditor.id).attr("maxlength");
if (maxlength) {
// grabbing the length of the curent editors content
tinylen = ed.getContent().length;
htmlcount = "HTML Character Count: " + tinylen + "/" + maxlength;
if (tinylen > maxlength) {
htmlcount = "" + htmlcount + "";
}
// write the html count into the path row of the active editor
tinymce.DOM.setHTML(tinymce.DOM.get(tinyMCE.activeEditor.id+ '_path_row'), htmlcount);
}
});//ed.onKeyUp.add
}//setup
});