I have a drop-down list that, when selected, will insert a bunch of elements in the form into the DOM using ajax, in this form I have text fields that I want to be TinyMCE text areas.
I have this inside my HTML head:
<script type="text/javascript">
tinymce.init({
selector: "textarea"
});
</script>
This is the ajax function that I use to add a bunch of elements, it works the way I need it.
function getSecFacility(facsecid, facid) {
$("#new_section_form").hide();
$.ajax({
type: "POST",
url: "facility_section_information.php",
data: 'facility_section_id='+facsecid+'&facility_id='+facid,
success: function(data){
$("#selected_fac_section").html(data);
}
});
};
I have other text fields on my page that are not inserted by ajax, and they appear in the WYSIWYG editor without problems, the problem is that I am adding new elements.
I checked a few other questions, trying to find the "answer", but nothing works.
loadTinyMCEEditor(), getSecFacility() ajax. tinyMCE .
loadTinyMCEEditor() :
function loadTinyMCEEditor() {
tinyMCE.init({
selector: "textarea"
});
tinyMCE.execCommand('mceAddControl', false, 'test'); //test is the class name I gave this textarea
//tinyMCE.execCommand('mceAddControl', true, 'test'); //tried setting the bool to true..even tried without these lines
}
, , . TinyMCE?
, . , , . ajax:
function getFacSecFacility(facsecid, facid) {
$("#new_section_form").hide();
$.ajax({
type: "POST",
url: "facility_section_information.php",
data: 'facility_section_id='+facsecid+'&facility_id='+facid,
success: function(data){
$("#selected_fac_section").html(data);
loadTinyMCEEditor();
}
});
};
function loadTinyMCEEditor() {
tinymce.init({
selector: "textarea"
});
}
, , , ajax + , tinymce, - .
/ , , , tinymce?