I will explain how to use jQuery to limit number of characters in textarea(textbox) even copy and paste text or jQuery restrict textbox(textarea) length even copy and paste text in textbox show below code. You may also like How to count same value in array using php and How to count same value comma separated string in php.
HTML Code
<textarea class="checkLimit" maxlength="100"></textarea>
<span id="count">100</span> Remaining Character
Jquery Code
<script language="javascript" type="text/javascript">
var maxLength = 100;
$('.checkLimit').keyup(function() {
var textlen = maxLength - $(this).val().length;
$('#count').text(textlen);
});
</script>