I want to add content to the TinyMce editor automatically at a specific place.
For this i use the following example:
First what you should do is add a span at the end of the content you want to create.
Then once inserted, do this…
ed.selection.select(ed.dom.select(‘span#caret_pos_holder’)[0]); //select the span
ed.dom.remove(ed.dom.select(‘span#caret_pos_holder’)[0]); //remove the span
Found here:
What's the best way to set cursor/caret position?
This works fine in de Chrome but throws an error in IE
“DOM Exception: INDEX_SIZE_ERR (1)”
Here is the function (located in one of my own custom plugins) i use
Example call: