最佳答案
如何使用 JavaScript 获得 <textarea>
中插入符号的位置?
例如: This is| a text
这应该返回 7
。
如何让它返回光标/选区周围的字符串?
例如: 'This is', '', ' a text'
。
如果单词“ is”突出显示,那么它将返回 'This ', 'is', ' a text'
。