LimitedTextArea is a javascript built on top of the prototype JS library. LimitedTextArea allows you to easily limit the number of words inputable to a textarea within a web form. LimitedTextArea can be called inline, or run unobtrusive.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README
limitedtextarea.js

README

USAGE:
 
 1.) Include this script after Prototype in the HEAD section of your HTML page
 
 <script src="/javascripts/prototype.js" type="text/javascript"></script>  
 <script src="/javascripts/limitedtextarea.js" type="text/javascript"></script>
 
 2.) Choose your implementation method
   
   A.) Unobtrusive (silent):
   Add the "rel" attribute to your textarea tag with a value of "limited". This will limit the textarea to default of 300 words.
   Example:
   <textarea cols="40" id="comment" name="comment" rel="limited" rows="20"></textarea>
   
   Adding "limited[##]" will allow you to override the limit on that textarea.
   Example:
   <textarea cols="40" id="comment" name="comment" rel="limited[250]" rows="20"></textarea>
 
   B.) Inline:
   You can also call the Limited TextArea Inline in your HTML.
   Options include:
   
     silent: true | false "true is default. false is required to run inline"
     id: dom_id of element "pass in the id of the textarea you wish to limit words on."
     limit: 300 "pass in the limit on the word count for this textarea. Defaults to 300"
   
   Example:
   <textarea cols="40" id="comment" name="comment" rows="20"></textarea>
   <script type="text/javascript" charset="utf-8">
     limited = new LimitedTextArea({
       silent: false,
       id: 'comment'
     });
   </script>