【问题标题】:How to import CKEditor through jQuery Ajax?如何通过 jQuery Ajax 导入 CKEditor?
【发布时间】:2011-04-24 00:39:21
【问题描述】:

我正在制作一个简单的数据网格应用程序,当我单击表格中的一行时,我希望能够导入一个带有 CKEditor 的 textarea 框。

现在,当我导入 .php 页面时,什么都没有显示。至于导入的所有其他 html 部分,页面上已经运行的 JS 并没有引用导入的 html。对于其他代码,我只是将 JS 重写为要导入的文件,但是当我使用 ckeditor 执行此操作时:

<script type='text/javascript'>
    window.onload = function() {
        CKEDITOR.replace( 'editor' );
    };
    CKEDITOR.replace( 'editor', {
        filebrowserBrowseUrl : 'ckeditor/browse.php',
        filebrowserUploadUrl : 'ckeditor/upload.php'
    });
</script>

什么都没发生。当我导入主 ckeditr.js 文件时,它至少会显示出来,但编辑器变得无法聚焦。

有谁知道,我可以具体对 CKEditor 做些什么,或者一般来说,关于 JS 没有应用于导入的 html?

【问题讨论】:

    标签: php jquery ajax ckeditor


    【解决方案1】:

    迈克,

    首先确保您在 html 头示例中加载了 ckeditor

     <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
         <script type="text/javascript" src="js/ckeditor/ckeditor.js"></script>
        </head>
        ....
    

    然后运行动态ckeditor的文档准备示例

    $(document).ready(function(){
          $('body').append('<textarea id="editor" />');
           CKEDITOR.replace( 'editor' );
    });
    

    注意

    这篇文章包括 jquery

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-15
      • 1970-01-01
      • 1970-01-01
      • 2020-04-07
      • 2019-12-22
      相关资源
      最近更新 更多