Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
101
rated 0 times [  102] [ 1]  / answers: 1 / hits: 25907  / 14 Years ago, mon, february 21, 2011, 12:00:00


I use CKEditor in my web-application. By click on one link i appends some text to CKEditor. It works fine. But when I open source tab, i can not append this text to the existing source. Can you help me how can I do it? Thank you in advance. Sorry for my english.


More From » html

 Answers
46

If you are trying to append HTML text, you could use the createFromHtml method like this for example:



var imgHtml = CKEDITOR.dom.element.createFromHtml(<img src= + imageSrcUrl +  alt='' align='right'/>);


where imageSrcUrl is the image location and then you can insert it into the ckeditor source like this:



CKEDITOR.instances.body.insertElement(imgHtml);


There are other methods like insertHtml or insertText, you can check the CKEditor APIs for more details on these.


[#93651] Friday, February 18, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
talonb

Total Points: 596
Total Questions: 103
Total Answers: 91

Location: Northern Mariana Islands
Member since Fri, Jan 15, 2021
3 Years ago
;