TinyMCE instance using ajax only works once

I need to initialize tinymce from the requested ajax 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 the data into <div id="calldata"> in the main script. But after the second request clicking on link_2, link_3, ... I only get an empty text field without tinymce. Only restarting index.php helps to fix the situation, but only once.

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.

+4
source share
2 answers

If you have an ajax request that changes the contents of your #tinymce div, you will need to reinitialize the tinymce editor after the changes are loaded.

Perhaps add the following to any action you invoke via ajax:

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

This will re-initialize the page after the page has fully loaded.

0
source

add
$("#tinymce").tinymce({ /* lot of tinymce data */ });

in the success function in your ajax call. it worked for me.

0
source

All Articles