You should be able to do this with some Javascript. A quick Internet search for 'javascript' and 'word count' yields quite a few examples. Would love to see the solution you use when you're done!
The 'control' in this case is the text entry box. When the user clicks outside of the box or clicks on a button or whatever, the control loses focus. You typically use this condition with a text entry box; you can assume the user is done typing when the control has lost focus because the cursor is no longer in the text entry box. Hope that clarifies...
It did! I get it. Thanks for explaining. I haven't used text boxes much. However, we are looking at doing a Plan of Action aspect built into the courses for them to type their thoughts. It sounds like I would use this in this scenario. Thanks again.
And I have a question. It seems contractions are counted as two words. Since I know nothing about javascript, except that I'm good at C/P it - how could your script be edited to accommodate contractions?
I see that there's stuff in there for white space and non-alphanumeric characters, but I have no idea what to do with it.
Thanks, Nancy for the question and Steve for the response. This one's a keeper in what's becoming my ever-growing resource list!
Good catch Rebecca. I'll look into this when I get a moment. I also noticed that numbers with decimals are counted as two words, such as '0.5', but '.5' is OK. I'm sure there are a few other bugs lurking.
I understand that contractions replace two (or more) words and arguably could be defined as such. Interestingly, some dictionaries define this as "a word" formed by leaving letters out of two (or more) words; others are less clear, simply saying a shortening of a word or words.
Microsoft Word, THE authority on all things grammatical counts them as one word.
I guess it depends on what the client wants. I did a quick search (VERY quick) and found that writing contests with word count limitations consider them to be one word.
Ah, I guess it got lost in the translation. Either the dry digital translation, or across the border to the U.S. from Canada . I really did think you were serious.
Steve, tx for the latest iteration.
Have a good W/E, all. We'll be shoveling here in New England!
14 Replies
Hi Nancy,
You should be able to do this with some Javascript. A quick Internet search for 'javascript' and 'word count' yields quite a few examples. Would love to see the solution you use when you're done!
Nancy,
I got intrigued so I put together a little Word Count Demo.
Steve this is exactly what I wanted to do. Thanks so much you save me a bunch of time.
Can someone explain the idea behind the "control loses focus" option? When what type of situations would I be looking at using this?
The 'control' in this case is the text entry box. When the user clicks outside of the box or clicks on a button or whatever, the control loses focus. You typically use this condition with a text entry box; you can assume the user is done typing when the control has lost focus because the cursor is no longer in the text entry box. Hope that clarifies...
It did! I get it. Thanks for explaining. I haven't used text boxes much. However, we are looking at doing a Plan of Action aspect built into the courses for them to type their thoughts. It sounds like I would use this in this scenario. Thanks again.
Wow, Steve! This is so very cool!
And I have a question. It seems contractions are counted as two words. Since I know nothing about javascript, except that I'm good at C/P it - how could your script be edited to accommodate contractions?
I see that there's stuff in there for white space and non-alphanumeric characters, but I have no idea what to do with it.
Thanks, Nancy for the question and Steve for the response. This one's a keeper in what's becoming my ever-growing resource list!
Good catch Rebecca. I'll look into this when I get a moment. I also noticed that numbers with decimals are counted as two words, such as '0.5', but '.5' is OK. I'm sure there are a few other bugs lurking.
There could be a case for saying that a contraction is 2 words.
Hi Nancy,
I understand that contractions replace two (or more) words and arguably could be defined as such. Interestingly, some dictionaries define this as "a word" formed by leaving letters out of two (or more) words; others are less clear, simply saying a shortening of a word or words.
Microsoft Word, THE authority on all things grammatical counts them as one word.
I guess it depends on what the client wants. I did a quick search (VERY quick) and found that writing contests with word count limitations consider them to be one word.
Hi Rebecca, I was joking. I guess my sense of humour is a little too dry sometimes.
Here's a new version that takes into account the apostrophe and decimal.
Hi Nancy,
Ah, I guess it got lost in the translation. Either the dry digital translation, or across the border to the U.S. from Canada . I really did think you were serious.
Steve, tx for the latest iteration.
Have a good W/E, all. We'll be shoveling here in New England!
This is great! Thank you for posting this. I had a request that an answer had to have at least 4 words and this made it easy.