0

如何使用javascript动态创建tinymce实例?到目前为止,这是我的代码:

javascript:

$(function()
{   

    $("#onesnippet").click(function()
    {
        alert("One Snippet");

        var idiv = document.getElementById('translations');
        var newdiv = document.createElement('div');
        newdiv.id = 10;
        idiv.appendChild(newdiv);

        var latestdiv = document.createElement('div')
        latestdiv.id = 4;
        newdiv.appendChild(latestdiv);

        var textarea1 = document.createElement('textarea');
        textarea1.id = "mceEditor3";
        textarea1.className = "mceEditor";

        latestdiv.appendChild(textarea1);
    });

}); 

php 文件以包含 tinymce :

<script>
        tinymce.init({mode : "specific_textareas", element : "mceEditor,mceEditor1,mceEditor2,mceEditor3", editor_selector : "mceEditor"});
</script>
4

1 回答 1

0

您完成代码,然后添加编辑器启动代码。

$(function()
{   

    $("#onesnippet").click(function()
    {
        alert("One Snippet");

        var idiv = document.getElementById('translations');
        var newdiv = document.createElement('div');
        newdiv.id = 10;
        idiv.appendChild(newdiv);

        var latestdiv = document.createElement('div')
        latestdiv.id = 4;
        newdiv.appendChild(latestdiv);

        var textarea1 = document.createElement('textarea');
        textarea1.id = "mceEditor3";
        textarea1.className = "mceEditor";

        latestdiv.appendChild(textarea1);

        tinymce.init({mode : "specific_textareas", element : "mceEditor,mceEditor1,mceEditor2,mceEditor3", editor_selector : "mceEditor"});

    });

}); 
于 2013-06-03T07:02:58.470 回答