I have a page with 2 working tinymce editor when i display it. Textarea is dynamicaly added to the page with a user control (page already loaded). The following js/coffescript aim to add a tinymce editor to the new textarea:
$(document).on 'nested:fieldAdded', (event) ->
tinyMCE.execCommand("mceAddControl", false, event.field.find('textarea').attr("id"))
If i do an alert event.field.find('textarea').attr("id")
, it returns the correct ID of the textfield where the editor should be added. However, it does not add tinyMCE to the textarea. I can also see that when the alert is displayed, the textarea exist on the page, I guess it means it exist when the script try to add tinymce.
At the top of my body i have the following script :
<script type="text/javascript">
//<![CDATA[
tinyMCE.init({"selector":"textarea.tinymce","theme_advanced_toolbar_location":"top","theme_advanced_toolbar_align":"left","theme_advanced_statusbar_location":"bottom","theme_advanced_buttons3_add":"tablecontrols,fullscreen","plugins":"paste,table,fullscreen","dialog_type":"modal","content_css":"/assets/application.css"});
//]]>
</script>
What do I need to change to my script to succesfully add tinyMCE to the new textarea?