How can I refresh the tinymce content or refresh the tinymce iframe using jquery?
You need to use the remove() API to detach TinyMCE from the DOM before you close your Modal window. You can then use init() again when the modal is recreated.
The TinyMCE getContent and setContent methods You can do this using the getContent() API method. Let's say you have initialized the editor on a textarea with id=”myTextarea”. This will return the content in the editor marked up as HTML.
You can do this to check if the content is empty without parsing html: var content = tinymce. get('tinymceEditor'). getContent({format: 'text'}); if($.
This code is used to refresh tinymce:
tinyMCE.execCommand("mceRepaint");
You can use this statement to refresh (replace) the content:
editor.execCommand('mceSetContent', false, html);
Or if you want to make sure the dirty flag is cleared:
editor.execCommand('mceSetContent', false, html);
editor.startContent = tinymce.trim(editor.getContent({ format: 'raw' }));
editor.isNotDirty = true;
editor.nodeChanged();
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