/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function textCounter(field, countfield, maxlimit) { if (field.value.length > maxlimit){ field.value = field.value.substring(0, maxlimit); } else { countfield.value = maxlimit - field.value.length } } $('textarea').keydown(function(){ textCounter(this.form.campo9,this.form.remLen,3000); }); $('textarea').keyup(function(){ textCounter(this.form.campo9,this.form.remLen,3000); });