For some reason, I need to execute :
tinyMCE.activeEditor.setContent(text, {format : 'html'});
After that, how to put the cursor to the end of the text ?
ed.selection.select(ed.getBody(), true); // ed is the editor instance
ed.selection.collapse(false);
This seems to be answered by Peter Wooster in thread jQuery Set Cursor Position in Text Area
EDIT For TINYMCE use:
tinyMCE.activeEditor.selection.select(tinyMCE.activeEditor.getBody(), true);
tinyMCE.activeEditor.selection.collapse(false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With