2013-11-15 161 views

回答

0

我不會稱之爲「JavaScript的重新初始化」,但我認爲你會遇到基本問題。對tinymce.init({selector: "textarea, .some-other-selector"})的調用適用於執行此調用時出現的所有頁面元素。你最有可能把它放在一個document.ready()塊中。

當您通過AJAX調用添加textarea時,您需要再次進行此調用。撥打此電話的最合適的地方是撥打您的ajax電話的.done()回撥。例如:

$.ajax(
    //your call parameters here 
).done(function(data){ 
    //Assuming you want to insert the returned data into a div with class parent-div 
    $("div.parent-div").html(data); 
    tinymce.init({ 
     selector: ".parent-div textarea" //Assuming this is the element you want 
    }); 
});