You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-25Lines changed: 30 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,32 +109,37 @@ Fires when counter is under min limit.
109
109
## Options
110
110
111
111
```javascript
112
-
type :"character", // "character" or "word"
113
-
min :0, // minimum number of characters/words
114
-
max :200, // maximum number of characters/words, -1 for unlimited, 'auto' to use maxlength attribute
115
-
countContainerElement :"div", // HTML element to wrap the text count in
116
-
countContainerClass :"text-count-wrapper", // class applied to the countContainerElement
117
-
textCountClass :"text-count", // class applied to the counter length
118
-
inputErrorClass :"error", // error class appended to the input element if error occurs
119
-
counterErrorClass :"error", // error class appended to the countContainerElement if error occurs
120
-
counterText :"Total Count: %d", // counter text, %d replaced with count value
121
-
errorTextElement :"div", // error text element
122
-
minimumErrorText :"Minimum not met", // error message for minimum not met,
123
-
maximumErrorText :"Maximum exceeded", // error message for maximum range exceeded,
124
-
displayErrorText :true, // display error text messages for minimum/maximum values
125
-
stopInputAtMaximum :true, // stop further text input if maximum reached
126
-
countSpaces :false, // count spaces as character (only for "character" type)
127
-
countDown :false, // if the counter should deduct from maximum characters/words rather than counting up
128
-
countDownText :"Remaining: %d", // count down text, %d replaced with remaining value
129
-
countExtendedCharacters :false, // count extended UTF-8 characters as 2 bytes (such as Chinese characters)
130
-
twoCharCarriageReturn :false, // count carriage returns/newlines as 2 characters
112
+
type :"character", // "character" or "word"
113
+
min :0, // minimum number of characters/words
114
+
max :200, // maximum number of characters/words, -1 for unlimited, 'auto' to use maxlength attribute, 'autocustom' to use a custom attribute for the length (must set "autoCustomAttr")
115
+
autoCustomAttr :"counterlimit", // custom attribute name with the counter limit if the max is 'autocustom'
116
+
countContainerElement :"div", // HTML element to wrap the text count in
117
+
countContainerClass :"text-count-wrapper", // class applied to the countContainerElement
118
+
textCountMessageClass :"text-count-message", // class applied to the counter message
119
+
textCountClass :"text-count", // class applied to the counter length (the count number)
120
+
inputErrorClass :"error", // error class appended to the input element if error occurs
121
+
counterErrorClass :"error", // error class appended to the countContainerElement if error occurs
122
+
counterText :"Total Count: %d", // counter text
123
+
errorTextElement :"div", // error text element
124
+
minimumErrorText :"Minimum not met", // error message for minimum not met,
125
+
maximumErrorText :"Maximum exceeded", // error message for maximum range exceeded,
126
+
displayErrorText :true, // display error text messages for minimum/maximum values
127
+
stopInputAtMaximum :true, // stop further text input if maximum reached
128
+
countSpaces :false, // count spaces as character (only for "character" type)
129
+
countDown :false, // if the counter should deduct from maximum characters/words rather than counting up
130
+
countDownText :"Remaining: %d", // count down text
131
+
countExtendedCharacters :false, // count extended UTF-8 characters as 2 bytes (such as Chinese characters)
132
+
twoCharCarriageReturn :false, // count carriage returns/newlines as 2 characters
133
+
countOverflow :false, // display text overflow element
134
+
countOverflowText :"Maximum %type exceeded by %d", // count overflow text
135
+
countOverflowContainerClass :"text-count-overflow-wrapper", // class applied to the count overflow wrapper
131
136
132
137
// Callback API
133
-
maxunder:function(el){}, // Callback: function(element) - Fires when counter is under max limit
134
-
minunder:function(el){}, // Callback: function(element) - Fires when counter is under min limit
135
-
maxcount:function(el){}, // Callback: function(element) - Fires when the counter hits the maximum word/character count
136
-
mincount:function(el){}, // Callback: function(element) - Fires when the counter hits the minimum word/character count
137
-
init:function(el){} // Callback: function(element) - Fires after the counter is initially setup
138
+
maxunder:function(el){}, // Callback: function(element) - Fires when counter under max limit
139
+
minunder:function(el){}, // Callback: function(element) - Fires when counter under min limit
140
+
maxcount:function(el){},// Callback: function(element) - Fires when the counter hits the maximum word/character count
141
+
mincount:function(el){},// Callback: function(element) - Fires when the counter hits the minimum word/character count
142
+
init:function(el){}// Callback: function(element) - Fires after the counter is initially setup
-[juliovedovatto](https://github.com/juliovedovatto) / [alvaro-canepa](https://github.com/alvaro-canepa) - multiple classes support for counter container
-[jmichalicek](https://github.com/jmichalicek) - count carriage returns/newlines as 2 characters
162
-
-[diptopol](https://github.com/diptopol) - `stopInputAtMaximum` with `twoCharCarriageReturn` count fix, trimmed newline calculation fix, maximum text reached condition fix, text count overflow notification
167
+
-[diptopol](https://github.com/diptopol) - `stopInputAtMaximum` with `twoCharCarriageReturn` count fix, trimmed newline calculation fix, maximum text reached condition fix, text count overflow notification
Copy file name to clipboardExpand all lines: textcounter.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -304,7 +304,7 @@
304
304
$.textcounter.defaultOptions={
305
305
'type' : "character",// "character" or "word"
306
306
'min' : 0,// minimum number of characters/words
307
-
'max' : 200,// maximum number of characters/words, -1 for unlimited, 'auto' to use maxlength attribute, 'autocustom' to use a custom attribute for the length (must)
307
+
'max' : 200,// maximum number of characters/words, -1 for unlimited, 'auto' to use maxlength attribute, 'autocustom' to use a custom attribute for the length (must set "autoCustomAttr")
308
308
'autoCustomAttr' : "counterlimit",// custom attribute name with the counter limit if the max is 'autocustom'
309
309
'countContainerElement' : "div",// HTML element to wrap the text count in
310
310
'countContainerClass' : "text-count-wrapper",// class applied to the countContainerElement
0 commit comments