jquery plugin issues with counting chars when returns are used
I have a problem with jquery.charcounter.js its not counting returns as /r/n its counting them as 1 char instead of 3 or 4 here is the code is there a way around it
if (el.val().length > max) {
el.val(el.val().substring(0, max));
if (settings.pulse &&开发者_开发百科 !p) {
pulse(container, true);
};
};
This really has nothing to do with jQuery or even charcounter, the .length property is purely javascript. As far as I know, \n is always counted as 1 character rather than two. I'm not sure what issue you're running into from this, but you may want to read this post:
String length differs from Javascript to Java code
精彩评论