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
@mimo84 I think he used a timeout because if you try to get a value from a element just after paste operation it will be empty value instead of a new text pasted. i mean, i dont know why this happen, but after a while it will have the text copy pasted.... it seems a strange behavior for me.
As long as I remember, the problem was that if you have maxlength property on textarea than copy paste behaves differently. So just change maxlength to something like data-maxlength would solve the issue.
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.
Activity
dvelayos commentedon Apr 29, 2015
i think it's a problem counting line breaks as 2 chars instead of 1
mimo84 commentedon Oct 10, 2015
Why a timeout after a paste should fix this issue?
diego3 commentedon Apr 19, 2016
@mimo84 I think he used a timeout because if you try to get a value from a element just after paste operation it will be empty value instead of a new text pasted. i mean, i dont know why this happen, but after a while it will have the text copy pasted.... it seems a strange behavior for me.
aamirafridi commentedon Apr 21, 2016
As long as I remember, the problem was that if you have maxlength property on textarea than copy paste behaves differently. So just change maxlength to something like data-maxlength would solve the issue.
41GitHub commentedon Jun 26, 2017
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)));