Skip to content

Script that counts characters of any field you can write on in HTML.

Notifications You must be signed in to change notification settings

SerCantus/character-counter.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

character-counter.js

Script that counts characters of any field you can write on in HTML.

Character counter for text fields in HTML

Character-counter.js is a script that counts the characters in a text-input field. By default, character-counter.js looks for a text field with "id = messagebody" and appends the counter behind it. Also, by default, uses CSS variable 'color' from body for the color of the counter.
  • Character-counter.js supports copy and paste of text

HOW TO USE

Character-counter.js is designed for a specific case, but you can change it to your needs easely. In the code case, it counts the characters from a textbox with "id=messagebody" and a not null maxlength. It uses the maxlength to create the counter, then removes it (line 9). It also uses default body color to paint the counter.

To change ID (or way to search for input field), go to line 6. To change CSS, go to lines 19-23.

This code supports paste of text.

About

Script that counts characters of any field you can write on in HTML.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published