如何在<textarea>使用JavaScript中获得插入位置?
例如: This is| a text
这应该回来了7.
如何让它返回光标/选择周围的字符串?
例如:'This is', '', ' a text'.
如果突出显示"是"一词,那么它将返回'This ', 'is', ' a text'.
我想将元素放在选定文本上方.但我无法弄清楚坐标.
var sel = document.getSelection();
if(sel != null) {
positionDiv();
}
Run Code Online (Sandbox Code Playgroud)
示例:(图片)
alt text http://www.freeimagehosting.net/uploads/bf4035f29f.png