Character Counter | JavaScriptSource

Character Counter

JavaScriptSource Staff Mar 28, 2005


Use this script to limit the number of characters allowed in an input box. It will display the number of characters left. Easy to modify.

Field Name
100 characters left.


Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: characterCounter.js


Paste this code into your external CSS file or in the <style> section within the HEAD section of your HTML document.


Paste this code into the HEAD section of your HTML document.


Paste this code into the BODY section of your HTML document

Leave a Response


Just one: thank you so much! Being null in JS myself, you saved my a lot of work.[br /]Thanks again.

Vitali Kadenski Dec 12, 2008

This works fine, but by intercepting key up and key down there are other shortcuts like Ctrl z and Ctrl Y that do not work any more.[br /]Does anybody have any idea how to overcome this problem?[br /]Thanks

CC Dec 3, 2008

Thanks for making this snippet, it's come in very handy.

Paul Nov 18, 2008

Pretty neat code, it was very help full

Aristofanes gutierrez Aug 21, 2008

very nice cob:)

mehmet Jul 21, 2008