How can I set caret to some position in editor?

Problem appears in Firefox. In IE i do

range = element.ownerDocument.body.createTextRange();


                    if (range.findText(element.innerText))


                        move(“word”, 0);



and it works fine. But firefox doesn’t contain createTextRange() method. Can you tell me how can fix it?

In FireFox , Range and Selection objects can be used for the same purpose ( first to define some text range, second to select it )

Here solution:
var iframes = document.getElementsByTagName(“IFRAME”);
var currentFrame = iframes[iframes.length - 1]; //get current frame
var sel = currentFrame.contentWindow.getSelection();
sel.collapse(element, 0); // set caret to begin; sel.collapse(element, 1); - sets caret to end