Days
Hours
Minutes
Seconds
x

Froala Editor v4.2.0 is Here LEARN MORE

Skip to content

Miscellaneous

Word Counter

Using the word_counter.min.jsplugin it is possible to limit the number of words that can be introduced into the WYSIWYG HTML editor.

The maximum number of words can be changed using the wordCounterMax option.

Try it yourself:


Edit in JSFiddle


HTML

<div id="editor">
  <p> Write some words here.</p>
</div>

JAVASCRIPT

<script>
  let editor = new FroalaEditor('#editor', {
    
 pluginsEnabled: ['wordCounter'],
        wordCounterCount: true,
        wordCounterMax: 200,
        events: {
"wordCounter.exceeded": function(){
console.log(this.wordCounter.wordCount());
},
"wordCounter.update": function(){
console.log(this);
   },
        }
    });


</script>