Contenteditable setCursorPos(elem, pos), pos = getCursorPos(elem)
Does anybody have workable solution to get or set cursor position in contenteditable div with elements inside? What I going to do is to create twitter-like field where I will insert on @ sign pressed. Problem is that browsers are pretty buggy with contenteditable attribute, so I cant rely on them for insert. So my algorithm is:
Problem with 2 and 5. I checked following questions:
And many more... There is NO workable solution (FF, Chrome, IE) for setCursorPos(elem, pos) - everywhere is move to the end or save and restore. Also I have getCursorPosition, but sometimes in chrome it gives incorrect results, so this function appreciated also!
Thanks a lot!
链接地址: http://www.djcxy.com/p/74330.html上一篇: 当使用箭头键时,Contenteditable跳转到另一个元素
下一篇: Contenteditable setCursorPos(elem,pos),pos = getCursorPos(elem)