I am using the following jQuery functionality to count words in real time:
$(\"input[type=\'text\']:not(:disabled)\").each(function(){
var input
Edit
Check this example.
Why don't you use split(" ")
instead of matching and dividing the result? You will have an array containing all your words, the length of the array will be the number of words.
var matches = $(field).val().split(" ");
Also, why are you adding every time the matches to the old result?
$('#finalcount').val(original_count + number)
Isn't this adding every time all the words twice?