3

In my page there is a list of buttons. Depending on the clicked button the same .php file is loaded with a different content for the <textarea>. Then TinyMCE is initialised and after that the content of TinyMCE is set.

However, this only works on the first click. When a user clicks a different button, the <textarea> is loaded, but TinyMCE is not initialised. I don't know why it's doing that, because it's the same script that is executed.

$("ul").on("click", "a.click-menu", function() {
    var id = $(this).attr("id");
    $(".inject").load("Including/modules/Pages/index.php?page="+id, function () {
        tinymce.init({selector:"textarea"});
    });
});

And this is index.php in a nutshell:

<?php

    echo '<textarea>'.$_GET['page'].'</textarea>';

?>
user3821544
  • 167
  • 1
  • 11

1 Answers1

2

You should remove old TinyMCE and add new one to new controls...

Heres how it should be made

Community
  • 1
  • 1
Flash Thunder
  • 11,672
  • 8
  • 47
  • 91