Countable is a JavaScript library to add live paragraph-, word- and character-counting to an HTML element. It is a zero-dependency library and comes in at just about 1KB when minified and gzipped.
yarn add countable
The preferred method of installation is yarn. Alternatively, you can download the script directly. Out of the box, Countable can be used with AMD loaders (require.js), CommonJS loaders (node, browserify) or directly in the browser.
Countable offers an easy to understand API. With a single method call you can enable live paragraph-, word- and character-counting on a given HTML element.
const area = document.getElementById('area')
const callback = counter => console.log(counter)
Countable.on(area, callback)
There are other methods you can use, all of which are thorougly described in the code itself, as well as in the full documentation.
View the full docs