# InputField Word Count?

**URL:** <https://forum.kirupa.com/t/inputfield-word-count/224448>\
**Category:** web dev\
**Created:** [May 2, 2007, 2:49pm UTC](https://forum.kirupa.com/t/inputfield-word-count/224448 "2007-05-02T14:49:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![woodman650](https://avatars.discourse-cdn.com/v4/letter/w/b9bd4f/32.png) [@woodman650](https://forum.kirupa.com/u/woodman650)\
**Post date:** [May 2, 2007, 2:49pm UTC](https://forum.kirupa.com/t/inputfield-word-count/224448/1 "2007-05-02T14:49:50Z")

</div>

Hey all,  
I’ve been working with this code for character counting in a field for a while:

```auto
<script language = "Javascript">
function taLimit() {
 var taObj=event.srcElement;
 if (taObj.value.length==taObj.maxLength*1) return false;
}
function taCount(visCnt) { 
 var taObj=event.srcElement;
 if (taObj.value.length>taObj.maxLength*1) taObj.value=taObj.value.substring(0,taObj.maxLength*1);
 if (visCnt) visCnt.innerText=taObj.maxLength-taObj.value.length;
}
</script>

```

It works very well, but I wondered if anybody might be able to give me some tips as to how I might modify it to count words, not characters? Thanks in advance!!
