开发者

Return caret postion or range of a div in IE8

I am wanting to return the start and end range or the caret postion inside a div. The div will have the attribute contentEditable.

typically I would use document.selection.createRange(); but the createRange function is broken in IE8 is there a way to开发者_如何学Python get around this?


document.selection.createRange(); works the same in IE 8 as it did in versions 7, 6, 5 and 4. If you mean you want an object that works like a DOM Range, as all other mainstream browsers have, I'd suggest using IERange, which creates Range-like objects from IE's TextRanges.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜