title: Counting and limiting words in a textarea
body: <p>I managed to make this little jquery function to count the number of words entered in textarea field.</p>
  
  <p><a href="http://jsfiddle.net/7DT5z/" rel="noreferrer">here is the fiddle</a></p>
  
  <p>and here is the code:</p>
  
  <p>JQUERY:</p>
  
  <pre><code>$(document).ready(function()
  {
  var wordCounts = {};
  $("#word_count").keyup(function() {
      var matches = this.value.match(/\b/g);
      wordCounts[this.id] = matches ? matches.length / 2 : 0;
      var finalCount = 0;
      $.each(wordCounts, function(k, v) {
          finalCount += v;
      });
      $('#display_count').html(finalCount);
      am_cal(finalCount);
  }).keyup();
  }); 
  </code></pre>
  
  <p>and here is html code</p>
  
  <pre><code>&lt;textarea name="txtScript" id="word_count" cols="1" rows="1"&gt;&lt;/textarea&gt;
  Total word Count : &lt;span id="display_count"&gt;0&lt;/span&gt; words.
  </code></pre>
  
  <p>how can i make modifications in it to have the output like this</p>
  
  <p>Total word Count : 0 words. Words left : 200</p>
  
  <p>and when it reach 200 words it shall not allow to either paste, or type more words in the textarea field, in jquery? i.e. it shall restrict user to type exactly 200 words not more than that.</p>
  
  <p>Please help.</p>
  
  <p>Thanks a lot in advance.</p>
  
  <p>EDIT: The modification is needed in this code only, as i am very well aware of the plugins, but they may interfere with the main code.</p>