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>';
?>