title: Limit words in a textarea
body: <p>I've done a bit of searching on this. Found plenty of scripts that counted characters and even counted words but couldn't find one that removes any words that go over the word limit....</p>
  
  <p>Here is my script so far...:</p>
  
  <pre><code>var maxWords = 10;
  function countWordsLeft(field) {    
      totalWords = field.value.split(' ');    
      if (totalWords.length &gt; maxWords)
          field.value = field.value.substring(0, maxWords);
      else
          document.getElementById('description_count').innerHTML = maxWords - totalWords.length;
  }
  </code></pre>
  
  <p>I've got the following line which I copied from a character count script but obviously this wont work because I am counting words</p>
  
  <pre><code>if (totalWords.length &gt; maxWords)
     field.value = field.value.substring(0, maxWords);
  </code></pre>
  
  <p>How do I make the script delete any extra words added over the limit? I need this especially if they paste in a description... It needs to count the words and then delete any words over the limit.</p>
  
  <p>Appreciate your help!</p>