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中苦苦挣扎。我怎么能得到确切的字符数?

  1. If I use $("#eidtor").text(), then it does not count new lines while typing
  2. 如果我使用$(“#eidtor”)。text(),那么在输入时它不会计算新行

  3. If I user $("#eidtor").html(), then it gives me count with html contents while typing.
  4. 如果我使用$(“#eidtor”)。html(),那么它会在输入时为我计算html内容。

  5. 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.
  6. 如何处理如果用户粘贴的文本长度超过最大长度。它为粘贴文本中的新行创建

    ... 。如果我根据文本进行子串,则其新行字符将被删除。

    更多相关文章

    1. 使用append方法将对象转换为字符串
    2. $.each遍历JSON字符串和 Uncaught TypeError: Cannot use 'in' o
    3. 如何在python中使用命名组和datadict从正则表达式模式中组合字符
    4. 字符串压缩 牛客网 程序员面试金典 C++ Python
    5. Python正则表达式在分隔符之间查找特殊字符
    6. Python 用hashlib求中文字符串的MD5值
    7. 将字节列表转换为字节字符串
    8. 数组与矩阵---需要排序的最短子数组长度
    9. [D]用python提取多段字符串该怎么写正则表达式。

    随机推荐

    1. Android打开摄像头拍照,并显示出来
    2. 详解Android中的Activity生命周期
    3. ExpandableListView
    4. Android与J2ME区别之我见(1)
    5. Android SDK下载慢的解决办法
    6. java.security.NoSuchProviderException:
    7. Android 各个版本WebView
    8. Android(安卓)8.0无法调用Geocoder 中的g
    9. 自定义控件与Handler
    10. 浅析GridView制作九宫格列表