Skip to content

mobvox/sms-counter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMS Counter

Character counter for SMS messages.

Usage

SmsCounter.count('content of the SMS')

This will return the following object:

{
	encoding: "GSM_7BIT",
	length: 18,
	messages: 1,
	per_message: 160,
	remaining: 142
}

jQuery Plugin

Given the following markup:

<textarea name="message" id="message"></textarea>
<ul id="sms-counter">
	<li>Encoding: <span class="encoding"></span></li>
	<li>Length: <span class="length"></span></li>
	<li>Messages: <span class="messages"></span></li>
	<li>Per Message: <span class="per_message"></span></li>
	<li>Remaining: <span class="remaining"></span></li>
</ul>

You can use the countSms jQuery extension to update the count on keyup:

$('#message').countSms('#sms-counter')

TODO

  • Better docs

Known Issue

  • Detects wrong encoding, when a euro [€] symbol stands at the beginning of the string.

License

SMS Counter is released under the MIT License.

About

Character counter for SMS messages.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published