Question and answer is powered by AnsPress.io
The character limit for TextArea using jQuery
<textarea name="enter_description" class="class-description"></textarea>
I have added a TextArea to enter some valuable data. I want to set a limit for entering characters in textarea. How can I set the character limit for TextArea using jQuery?
To set character limit for textarea using jQuery, apply this code
$('textarea').on('keyup, input',function(){ var _msgLenght = $(this).val().length; if (_msgLenght > 30) { $(this).val($(this).val().substring(0, 30)); } });