02 Votes

TinyMCE Editor not shown after second call

Question by Guest | 2016-01-06 at 11:04

I am encountering a strange problem with my TinyMCE HTML Editor on my website.

I have implemented the editor in the following way: With clicking the button "Edit", an editor window is displayed using JavaScript and Ajax. In this window TinyMCE should appear. I am executing the initialization of TinyMCE (tinymce.init) directly after the Ajax-insertion, so that TinyMCE is properly displayed and can be used.

All of that is working until that point. It becomes programmatic at the moment, the editor window is closed and should be shown for another time later. Altough the initialization command is executed also at the second time, TinyMCE is not displayed. Instead, you can only see the normal Textarea the same way, as if TinyMCE is not included at all.

What can I do to properly display TinyMCE also after its second call?

ReplyPositiveNegativeDateVotes
8Best Answer8 Votes

In this case, it should help to remove TinyMCE before the second call. For this, you can use the function .remove(), for example in the following way:

tinymce.remove(); 

tinymce.init({
  selector: "textarea"
});

Using tinymce.remove(), you are removing all editors from the current page. If you only want to remove one specific editor, you can pass the ID as a parameter, for example: tinymce.remove('#id').

Please consider that the function tinymce.remove() is only available since version 4 of TinyMCE. In older versions, you can use

tinyMCE.execCommand('mceRemoveControl',false,'mydiv') 

instead.
2016-01-06 at 16:35

ReplyPositive Negative
22 Votes

Thank you @Stefan Trost. Your answer very very helpful for me. Because, I am very tired for this recall issue.
2016-09-12 at 08:42

Positive Negative
00 Votes

Stefan Trost.. Thank you so much.. :) You answer helped me as well.
2019-05-21 at 11:06

Positive Negative
Reply
Reply

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.