Programatically insert text

Jul 15, 2008 at 11:06 PM
Is there a JavaScript function which will allow me to programatically insert text into the RTE?

For example, using the onclick attribute of an anchor tag, I would like to call a JavaScript function to programatically insert some text.

Thanks for your ideas.

Jul 17, 2008 at 5:59 PM
Never mind.  I answered my own question.

Here is the code to programmatically INSERT text into the RTE








var selCurrent = richeditor.GetDocument().selection.createRange();


selCurrent.type = richeditor.GetDocument().selection.type;


var replaceWith = document.getElementById(cntrl).innerText;


selCurrent.text = document.getElementById(cntrl).innerText;



Jan 21, 2010 at 9:54 PM

I'm trying to find an equivalent of this for firefox and having a bit of trouble. Can someone help?