Credits: http://www.jqeasy.com/
In some cases, you might want to display a character count to notify the user that they can enter only a certain number of characters in a text box in a Visualforce page.
There is a javascript file that you need to use to achieve the above behavior. The file was downloaded from jqeasy.com, i uploaded the file here in case you are not able to locate the file.
https://drive.google.com/file/d/0B5FQvDdE4z0PZU9JdC1mVk1BU28/view?usp=sharing&resourcekey=0-rI8WqomT9R9kZACQz_7RHw
STEP 1:
Download the file at https://drive.google.com/file/d/0B5FQvDdE4z0PZU9JdC1mVk1BU28/view?usp=sharing&resourcekey=0-rI8WqomT9R9kZACQz_7RHw and upload it into Static Resources. Let's say we name the file as "CharCounter".
STEP 2:
Create a Visualforce Page with the code below.
Analyzing the code:
If you check the code, you could see that we have the 'styleclass' attribute specified for the inputtextarea's.
And this styleclass name is used in the document.ready() function to specify the character limits. You could use the 'id' attribute as well, but make sure you reference id's using the $Component notation.