可编辑div中的文本计数和子字符串
16lz
2021-01-22
I am trying to create a message editor with editable div instead of textarea. I am struggling with character count in editable div. How I can get exact character count ?
我正在尝试使用可编辑的div而不是textarea创建一个消息编辑器。我在可编辑div中苦苦挣扎。我怎么能得到确切的字符数?
- If I use $("#eidtor").text(), then it does not count new lines while typing
- If I user $("#eidtor").html(), then it gives me count with html contents while typing.
- How I can handle If user paste text which is longer then maximum length. It creates
<div>...</div>
for new line in pasted text. If I do substring based on text then its new line character is getting removed. - 使用append方法将对象转换为字符串
- $.each遍历JSON字符串和 Uncaught TypeError: Cannot use 'in' o
- 如何在python中使用命名组和datadict从正则表达式模式中组合字符
- 字符串压缩 牛客网 程序员面试金典 C++ Python
- Python正则表达式在分隔符之间查找特殊字符
- Python 用hashlib求中文字符串的MD5值
- 将字节列表转换为字节字符串
- 数组与矩阵---需要排序的最短子数组长度
- [D]用python提取多段字符串该怎么写正则表达式。
如果我使用$(“#eidtor”)。text(),那么在输入时它不会计算新行
如果我使用$(“#eidtor”)。html(),那么它会在输入时为我计算html内容。
如何处理如果用户粘贴的文本长度超过最大长度。它为粘贴文本中的新行创建
... 。如果我根据文本进行子串,则其新行字符将被删除。