如何通过 jQuery Ajax 导入 CKEditor?
我正在制作一个简单的数据网格应用程序,当我单击表中的一行时,我希望能够导入带有 CKEditor 的文本区域框。
现在,当我导入 .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?
I'm making a simple data grid aplication and when I click a row in a table, I want to be able to import a textarea box with CKEditor on it.
Now when I import the .php page, nothing shows up. As for every other html part, that was imported, the already running JS on the page isn't refering to the imported html. For the other code, I just rewrite the JS to the file being imported, but when I do that with ckeditor with:
<script type='text/javascript'>
window.onload = function() {
CKEDITOR.replace( 'editor' );
};
CKEDITOR.replace( 'editor', {
filebrowserBrowseUrl : 'ckeditor/browse.php',
filebrowserUploadUrl : 'ckeditor/upload.php'
});
</script>
Nothing heppens. When I import the main ckeditr.js file, it shows up at least, but the editor becomes unfocusable.
Does anyone know, what I can do about CKEditor concretely, or generally about the JS not being applyed on imported html?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
迈克,
首先确保您在 html head 示例中加载 ckeditor
,然后运行动态 ckeditor 的文档就绪示例
注意
这篇文章包含 jquery
Mike,
first make sure you load the ckeditor in your html head example
then run doc ready exmample of dynamic ckeditor
NOTE
this post includes jquery