Count the words in HTML articles using JavaScript (no dependencies)
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
index.html
jsWordCount.css
jsWordCount.js
license.txt
readme.md

readme.md

jsWordCount

This code counts the words within in HTML documents providing summaries for paragraphs, sections, articles and the body. Summaries are added to elements using HTML5 data attributes under the name data-jsWordCount.

Use

  1. Add jsWordCount.js to any HTML5 document.
  2. Add jsWordCount.css to the docmument.
  3. Load the document.
  4. Observe that word counts are added to elements.

The sample cascading style sheet uses this data-jsWordCount value to augment on-screen content using the :before pseudo selector.

License

Free Software: see [license.txt][license.txt] Copyright (c) 2011 Rich Boakes http://boakes.org

[license]: jsWordCount/license.txt "MIT License (GPL v3 compatible) [modal]: http://example.com/ "Modal Dialogue explained on Wikipedia"