title: textarea character limit
body: <p>I would like to be able to limit the number of characters in a textarea. The method I am using works great in Google Chrome, but is slow in Firefox, and doesn't work in IE.</p>
  
  <p>Javascript:</p>
  
  <pre><code>function len(){
    t_v=textarea.value;
    if(t_v.length&gt;180){
      long_post_container.innerHTML=long_post;
      post_button.className=post_button.className.replace('post_it_regular','post_it_disabled');
      post_button.disabled=true;
    }
    else{
      long_post_container.innerHTML="";
      post_button.className=post_button.className.replace('post_it_disabled','post_it_regular');
      post_button.disabled=false;
    }
    if(t_v.length&gt;186){
          t_v=t_v.substring(0,186);
      }
  }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;textarea id="user_post_textarea" name="user_post_textarea" cols="28" rows="1"  onkeypress="len();" onkeyup="len();"&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>Javascript at bottom of body element:</p>
  
  <pre><code>textarea=document.getElementById('user_post_textarea');
  </code></pre>