Skip to content

Commit 070f851

Browse files
author
Diptopol Dam
committed
Fixed maximum error text occurance
Maximum error text should only occur when character or word count exceeds maximum limit. Currently error message is given at the maximum limit. Fixed the issue.
1 parent 5a2b85d commit 070f851

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

textcounter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,11 @@
8383
}
8484

8585
if (base.options.max !== -1) { // if a maximum value has been set
86-
if (textCount >= base.options.max && base.options.max !== 0) {
86+
if (textCount === base.options.max && base.options.max !== 0) {
8787
// TextCounter: maxcount(el) Callback
8888
base.options.maxcount(base.el);
8989

90+
} else if (textCount > base.options.max && base.options.max !== 0) {
9091
if (base.options.stopInputAtMaximum) { // if the string should be trimmed at the maximum length
9192
var trimmedString = '';
9293

textcounter.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)