Word Count | JavaScriptSource

Word Count

Shawn Seley Apr 30, 2001
Finally, an easy way to count the number of words that are entered into a form!

The JavaScript Source: Forms: Word Count

Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Command-s). The script is yours!!!


Did you use this script?  Do you like this site?  Please link to us!

Leave a Response


I have been piecing together a tool for a website I use. I'm not proficient when it comes to JavaScript, and I've never taken the time to really learn how to get the most out of the regular expressions. So whilst I had most of what I needed in place, I was struggling with getting the expressions for part of the tool. I haven't used the script above, but I have used the expressions written by Shawn in order to be able to count words in a text box. The expressions I had written had trouble with extra words being generated if I created blank lines with spaces in them, and words being missed after a carriage return. Shawn's expressions solved those problems completely. It is fantastic that a resource written over a decade ago is still so easy to locate. Thanks for sharing them. (Have credited you and this link).

Damion Mar 30, 2014

Try entering the following: 1.22

Tim May 11, 2012