views:

52

answers:

2

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 get around this?

A: 

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.

Tim Down
A: 

Your description is a bit vague, but this might help:

If your editor consists of two documents (one containing toolbars and one containing the content of your document), you need to call document.focus() on the window object containing the content-document.

See here for a similar case: http://efreedom.com/Question/1-3209226/Changes-Selection-Range-Functionality-IE8