Days
Hours
Minutes
Seconds
x

New Froala Editor v5.0.0 is here โ€“ Learn More

Skip to content
Froala Documentation

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>
Sign up

Download the code by signing up for our newsletter

Sign up

Download the code by signing up for our newsletter

Note: By registering, you confirm that you agree to the processing of your personal data by Froala, Inc. - Froala as described in the Privacy Statement. Froala, Inc. - Froala is part of the Idera group and may share your information with its parent company Idera, Inc., and its affiliates. For further details on how your data is used, stored, and shared, please review our Privacy Statement.