tags:

views:

556

answers:

1

I have to initialize tinymce from the ajax-requested script get.edit.php.

get.edit.php contains

<textarea id="tinymce" rows="8" cols="80" style="width:100%"></textarea>
<script type="text/javascript">
    $("#tinymce").tinymce({ 
       /* lot of tinymce data */
    });
</script>

and loads data into <div id="calldata"> in the main script. But after the second request clicking on link_2, link_3, ... I receive only an empty textfield without tinymce. Only reloading of index.php helps to correct a situation, but only once besides.

Can someone explain how to solve this problem? Thanx.

Edit: Solution found here: http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=22977 , but not for jQuery.

+1  A: 

If you have an ajax request that changes the content of your #tinymce div, then you will need to re-initialize the tinymce editor after the changes are loaded.

Maybe add the following to whatever action you call via ajax:

$(document).ready(function() {
  $("#tinymce").tinymce({ 
       /* lot of tinymce data */
    });
})

This will re-initialize it once the page has fully loaded.

deadwards
This has already been tried and unfortunately doesn't have the desired effect.
Vov4ik