I am trying to add a TinyMCE WYSIWYG editor to my textareas.
I have a table with a td
that the user can click to .load
a form with input fields, labels, textareas etc.
My td
looks like this:
<a href="#" id="display_info" onclick="displayFacilityInformation(61)">Something</a>
displayFacilityInformation()
looks like this:
function displayFacilityInformation (facID){
$("#facility_details").load("facilitydetails.php?q="+facID);
$('#facility_details_wrapper').show();
$("#newaccount_form, #newuser_form, #newfacility_form, #accounts, #facilities, #new_section_form").hide(); //hide other divs
//tinymce.EditorManager.execCommand('mceAddEditor',true, general_facility_info); //gave me console error "general_facility_info is undefined")
//tinyMCE.execCommand('mceAddEditor', true, 'general_facility_info');
//tinymce.init({
//selector: "textarea"
//});
//tinyMCE.execCommand('mceAddEditor', true, 'body');
};
The various things I have tried are commented out. (general_facility_info
is the ID of one of the textareas)
facilitydetails.php
outputs an HTML form to a div id="facility_details"
which has my textarea that I wish to become a tinyMCE editor.
My console is not throwing any errors and I am able to create other textareas that are tinymce editors in other (hidden) forms.
Does it have something to do with adding in elements with Jquery .load
?
How can I make the newly added textarea's tinyMCE editors?