How to count total character in textbox using Jquery

0

In this tutorial you are going to see how to write a jQuery script which should display the number of characters entered in a textbox realtime. This script could be very much useful if you want show the user how many characters the user has entered into a text box or textarea. You may also like How to limit character input in the textarea including count using Jquery and How to count same value comma separated string in php.

HTML Code

<textarea class="countCharacter"></textarea>
<div id="getcount"></div>

Jquery Code

<script type="text/javascript">
    $('.countCharacter').keyup(function(){
        var value  = $(this).val();
        var countvalue  = value.length;
        $('#getcount').html(countvalue);
    });
</script>