CKEditor Samples » WordCount Plugin

WordCount Plugin for CKEditor that counts the words an shows the word count in the footer of the editor..

In order to use the new plugin, include it in the config.extraPlugins configuration setting.

CKEDITOR.replace( 'textarea_id', {
	extraPlugins: 'wordcount', 
                maxWordCount: 4,
	        maxCharCount: 10,
                // optional events
	        paragraphsCountGreaterThanMaxLengthEvent: function (currentLength, maxLength) {
	                $("#informationparagraphs").css("background-color", "crimson").css("color", "white").text(currentLength + "/" + maxLength + " - paragraphs").show();
	        },
	        wordCountGreaterThanMaxLengthEvent: function (currentLength, maxLength) {
	                $("#informationword").css("background-color", "crimson").css("color", "white").text(currentLength + "/" + maxLength + " - word").show();
	        },
	        charCountGreaterThanMaxLengthEvent: function (currentLength, maxLength) {
	                $("#informationchar").css("background-color", "crimson").css("color", "white").text(currentLength + "/" + maxLength + " - char").show();
	        },
	        charCountLessThanMaxLengthEvent: function (currentLength, maxLength) {
	                $("#informationchar").css("background-color", "white").css("color", "black").hide();
	        },
	        paragraphsCountLessThanMaxLengthEvent: function (currentLength, maxLength) {
	                $("#informationparagraphs").css("background-color", "white").css("color", "black").hide();
	        },
	        wordCountLessThanMaxLengthEvent: function (currentLength, maxLength) {
	                $("#informationword").css("background-color", "white").css("color", "black").hide();
	        }
} );