jQuery plugin that provides a character counter for any text input or textarea. Works when typing and pasting text using the mouse.
- version - 0.4.2
- homepage - http://github.com/aaronrussell/jquery-simply-countable/
- author - Aaron Russell
Simple usage:
$('#my_textarea').simplyCountable();
Advanced usage:
$('#my_textarea').simplyCountable({
counter: '#counter',
countType: 'characters',
wordSeparator: ' ',
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){}
});
counter
- A jQuery selector to match the 'counter' element. Defaults to#counter
.countType
- Select whether to countcharacters
orwords
. Defaults tocharacters
.wordSeparator
- The word separator when countingwords
. Defaults to white-space.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.
Dual licensed under the MIT and GPL licenses.
Copyright (c) 2009-2010 Aaron Russell.