Tinymce content clear mceCleanup

Rejayi CS picture Rejayi CS · Feb 27, 2014 · Viewed 23.4k times · Source

I want to clear tinymce content and add new content. i tried with following code but its getting append to the old content. how can clear the existing content from tinymce.

tinymce.activeEditor.execCommand('mceCleanup');
tinymce.activeEditor.execCommand('mceInsertContent', false, result.content);

Answer

Gopesh picture Gopesh · Feb 27, 2014

Use :

tinyMCE.activeEditor.setContent('');

Sets the specified content to the editor instance, this will cleanup the content before it gets set using the different cleanup rules options.

Reference:TinyMce

Hope it helps.