This is the first time that I am using CKeditor on my website. Basically what I want to do is have a javascript event clear the content of the editor, then insert a certain message into it.
I assume that I can use setData to clear the content of my editor:
CKEDITOR.instances.editor.setData(' ');
Then I want to insert a message:
CKEDITOR.instances.editor.insertText( 'adfadsf' );
The content is cleared, but the message is not inserted into the editor, and Firebug gives me this error:
D.getStartElement() is null, of which I cannot make heads or tails... Please help! Thanks in advance!
I assume that I can use setData to clear the content of my editor:
CKEDITOR.instances.editor.setData(' ');
Then I want to insert a message:
CKEDITOR.instances.editor.insertText( 'adfadsf' );
The content is cleared, but the message is not inserted into the editor, and Firebug gives me this error:
D.getStartElement() is null, of which I cannot make heads or tails... Please help! Thanks in advance!
Re: about setData
setData is asynchronous (http://docs.cksource.com/ckeditor_api/s ... ml#setData), so if you call anything right after it, an error is the most probable outcome.
You should use the callback parameter or just set the text that you want with setData instead of first clearing the contents and then setting it to something.
Re: about setData
That makes sense. Much appreciated
Re: about setData