Posted By

thiagotargino on 09/02/11


Tagged

textarea limite


Versions (?)

Limite de caracteres em textarea


 / Published in: JavaScript
 

  1. function textCounter(field, countfield, maxlimit) {
  2. if (field.value.length > maxlimit){
  3. field.value = field.value.substring(0, maxlimit);
  4. } else {
  5. countfield.value = maxlimit - field.value.length
  6. }
  7. }
  8. $('textarea').keydown(function(){
  9. textCounter(this.form.campo9,this.form.remLen,3000);
  10. });
  11. $('textarea').keyup(function(){
  12. textCounter(this.form.campo9,this.form.remLen,3000);
  13. });

Report this snippet  

You need to login to post a comment.