Counter is incorrect when you paste text
See original GitHub issueIn your demo for textarea, type some text with line breaks in it. Copy it and than kept press Ctrl + V
to repeatedly paste the text and you can see the counter is wrong. Fix this issue and it will make it a good plugin 😃
Here is how you can do: https://github.com/aaronrussell/jquery-simply-countable/blob/master/jquery.simplyCountable.js#L123
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
jQuery - char counter doesn't work with paste event
Show activity on this post. I wrote a jQuery character counter, it works when I type, but not when text is pasted. The...
Read more >Control the formatting when you paste text - Microsoft Support
Follow these steps to turn it on. Go to File > Options > Advanced. In the Cut, copy, and paste section, select Show...
Read more >Wrong hyperref with repeated counter - LaTeX Stack Exchange
This is because the target of a hyperlink is based on the counter value. If the counter is reset then there is a...
Read more >Error occurred while manually uploading COUNTER 5 reports ...
Incorrect Formatting. This error usually indicates that the data within the file you are uploading is incorrectly formatted or corrupt.
Read more >WordCounter - Count Words & Correct Writing
Copy and paste your text into the online editor to count its words and characters, check keyword density, and correct writing mistakes.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
i think it’s a problem counting line breaks as 2 chars instead of 1
When you paste text in that is too long, the remaining variable becomes a negative number. When subtracting a negative the result goes positive. Check if remaining is less than zero and set remaining to zero if it is.
maxLengthIndicator.html(updateMaxLengthHTML(currentInput.val(), maxLengthCurrentInput, (maxLengthCurrentInput - remaining)));