Character-Limit for Textareas
I'm trying to add a Character-limit on all Textareas using this code:
- var limitNum = 40;
- $('.textarea__field').keyup(function(limitField, limitNum) {
- if (limitField.value.length > limitNum) {
- limitField.value = limitField.value.substring(0, limitNum);
- }
- });
Why it's not working?
Thanks