How to reinitialize the tinymce text box on the page

A small problem with the rich text editor tinymce.

At the beginning of the

page, there are some textarea, in window.onload. Write the initialization method of tinymce:

//tinymce
tinymce.init({
            selector: "textarea",
            language: "zh_CN",
            menubar: false,
            mode: "textareas",
            width: 700,
            height: 300,
            branding: false,
            plugins: "link lists textcolor wordcount colorpicker textpattern",
            toolbar: "bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify  | numlist bullist outdent indent  | removeformat",
        });

when the entire page is loaded, some more textarea, will be added dynamically. The problem encountered at this time is that these new dynamically added textarea, have the appearance of a tinymce editor, but the button cannot be clicked and the edit area cannot be edited.

personal feeling should be because it is not initialized (or activated? ) it"s no use for these newly added textarea, to try timing tinymce.remove () and then re-init.

I would like to ask if there are any similar problems? Thank you


Brother, I have the same problem as you. Did you solve it?


I have the same problem now. Have you solved it?


/ / Sets the HTML contents of the activeEditor editor
tinymce.activeEditor.setContent (' some html');

/ / Sets the raw contents of the activeEditor editor
tinymce.activeEditor.setContent (' some html', {format: 'raw'});

/ / Sets the content of a specific editor (my_editor in this example)
tinymce.get ('my_editor') .setContent (data);

/ / Sets the bbcode contents of the activeEditor editor if the bbcode plugin was added
tinymce.activeEditor.setContent ('[b] some [/ b] html', {format: 'bbcode'});


I also have this problem, may I ask how to solve it, thank you

Menu