jQuery Simply Countable plugin
jQuery plugin that provides a character counter for any text input or textarea. Works when typing and pasting text using the mouse.
- version - 0.5.0
- homepage - http://github.com/aaronrussell/jquery-simply-countable/
- author - Aaron Russell
Usage
Simple usage:
$('#my_textarea').simplyCountable();
Advanced usage:
$('#my_textarea').simplyCountable({
counter: '#counter',
countType: 'characters',
maxCount: 140,
strictMax: false,
countDirection: 'down',
safeClass: 'safe',
overClass: 'over',
thousandSeparator: ',',
onOverCount: function(count, countable, counter){},
onSafeCount: function(count, countable, counter){},
onMaxCount: function(count, countable, counter){}
});
Options
counter
- A jQuery selector to match the 'counter' element. Defaults to#counter
.countType
- Select whether to countcharacters
orwords
. Defaults tocharacters
.maxCount
- The maximum character (or word) count of the text input or textarea. Defaults to140
.strictMax
- Prevents the user from being able to exceed themaxCount
. Defaults tofalse
.countDirection
- Select whether to countdown
orup
. Defaults todown
.safeClass
- The CSS class applied to the counter element when it is within the maxCount figure. Defaults tosafe
.overClass
- The CSS class applied to the counter element when it exceeds the maxCount figure. Defaults toover
.thousandSeparator
- The separator for multiples of 1,000. Set tofalse
to disable. Defaults to,
.onOverCount
- Callback function called when counter goes overmaxCount
figure.onSafeCount
- Callback function called when counter goes belowmaxCount
figure.onMaxCount
- Callback function called when instrictMax
mode and counter hitsmaxCount
figure.
License
Dual licensed under the MIT and GPL licenses.
Copyright (c) 2009-2013 Aaron Russell.