Get the character count of a textarea including newlines

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 12:24:00

Seems to be a WebKit bug (consider filing it) related to treating CR/LF pair as two characters instead of one. Since it's usually noncritical if, say, 197 characters are allowed instead of 200, it's fine to ignore this.

But if you want, you can try to continuously save caret position, replace all \r\n to \n, and restore caret position in textarea while user is typing.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!