title: word count method
body: <p>I have recently used modified a word count method in javascript for my website, so that it counts the intial amount words in the textarea, but it doesn't quite work </p>
  
  <pre><code>function wordCounter(field,countfield)
  {
      var maxlimit = 200;
      var wordcounter = maxlimit - information.value.split(' ').length;
      for (x = 0; x &lt; field.value.length; x++) 
      {
          if(field.value.charAt(x) == " " &amp;&amp; field.value.charAt(x-1) != " ") // Counts the spaces while ignoring double spaces, usually one in between each word.
          {
              wordcounter++ 
          }
  
          if (wordcounter &gt; 250) 
          {
              field.value = field.value.substring(0, x);
          }
          else
          {
              countfield.value = maxlimit - wordcounter;
          }
      }
  }
  </code></pre>