phpfunk.com


Update

There is a new version of this javascript example. This original version is kept to demonstrate a simpler way of doing the same thing, but with less flexibility.

Example text area w/ javascript character counter

If you plan on only accepting a fixed number of characters from a textarea, its probably a good idea to tell the user how many they have left. This bit of javascript does just that. View page source for the code. I am checking the number of characters in the text field when the page loads by calling the function init_textarea_counter() (see source). You could also do <body onload="init_textarea_counter();">.


characters left