Skip to content

Script that helps to count number of characters in message and how many parts SMS will contain.

License

Notifications You must be signed in to change notification settings

giannisdag/smsapi-counter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Script that helps to count number of characters in message and how many parts SMS will contain.

Usage

You should add smsapi-counter.js or smsapi-counter.min.js files at the end of <body> element. You can find an example in demo.html file.

HTML

Activate counter with specified attributes. You have to target <textarea> and one random element (spanh1h2 etc) to show current characters count. With HTML you can activate one counter per page. To include more text areas with counters, use JavaScript activation method.

    <textarea data-cv-sms-textarea></textarea>
    <span data-cv-sms-counter></span>

Javascript

After loading smsapi-counter JavaScript file, use this method. You have to specify two parameters: ID of <textarea>, and ID of label that will show current characters count.

    CVSMSCounter.activate('textareaID', 'counterLabelID');

WARNING!

We reccomend to use UTF-8 encoding. Script might count characters wrong if you will use wrong encoding or message is filled using copy/paste method. If you want to protect additionally you can use parameters like nounicode, normalizemax_parts. You can find more details about parameters in SMSAPI.com specification.

About

Script that helps to count number of characters in message and how many parts SMS will contain.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 82.1%
  • HTML 17.9%