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 TextRange
s.
精彩评论