javascript ckeditor:“a 未定义”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26597939/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 06:11:10  来源:igfitidea点击:

ckeditor: "a is undefined"

javascriptjqueryckeditor

提问by Cute_Ninja

I just added CKEditor to my website, but I'm getting the following error in my console:

我刚刚将 CKEditor 添加到我的网站,但在我的控制台中出现以下错误:

http://i.imgur.com/p4c3J4E.png

http://i.imgur.com/p4c3J4E.png

I followed the installation guideas it's written so I have no idea what's wrong.

我按照安装指南的编写方式进行操作,所以我不知道出了什么问题。

Here's, briefly, what my call looks like:

简而言之,这是我的电话的样子:

<textarea id="full-editor" name="full-editor" rows="10" columns="6"></textarea>

<script type="text/javascript">
    CKEDITOR.replace('#full-editor');
</script>

回答by Cute_Ninja

Aah.. try this

啊..试试这个

Remove #from the selector inside CKEDITOR.replace('#full-editor');

#从选择器里面取出CKEDITOR.replace('#full-editor');

According to installation guide you shared, this is what u need

根据您分享的安装指南,这就是您所需要的

CKEDITOR.replace('full-editor'); // NO #. You must have got confused with jQuery

回答by Abdillah

This also happened whenever we put initializer script before <textarea>.

每当我们将初始化脚本放在<textarea>.

Ensure to put

确保放

<script>
  CKEDITOR.replace( 'editor1' );
</script>

before the </body>tag (i.e. closing body tag).

</body>标签之前(即结束正文标签)。

回答by Yashvant Zala

<script type="text/javascript"> CKEDITOR.replace('#full-editor'); </script>

<script type="text/javascript"> CKEDITOR.replace('#full-editor'); </script>

Please add above code in external js file and include this js in html page after title page like

请在外部 js 文件中添加以上代码,并将此 js 包含在标题页之后的 html 页面中,例如

$(document).ready(function () {// save as  like ckEditorInclude.js
  CKEDITOR.replace('#full-editor');
}
<script src="Your folder path/ckEditorInclude.js" type="text/javascript"></script>

回答by Jeewan Rai

This also happened whenever we put initializer script before . Ensure to put

每当我们将初始化脚本放在 . 确保放

CKEDITOR.replace( 'editor1' );

before the </body>tag (i.e. closing body tag).

</body>标签之前(即结束正文标签)。

回答by NDZIE Patrick Joel

This append to me because i was trying to use CKEDITOR.replace("editor") but there was no element in dom with Id or name "editor"

这个附加到我是因为我试图使用 CKEDITOR.replace("editor") 但在 dom 中没有带有 Id 或名称“editor”的元素

回答by George W

The issue for me was I copied the code locally from the cdn so that I can work on it if I am not online. I am using version 4.9.2 standard. Examining the chrome console gave several 404 errors which were not obvious using FireFox. Reverting back to the cdn resolved the issue. Unfortunately, no working offline with this it seems at least not for this version of ckeditor.

对我来说,问题是我从 cdn 本地复制了代码,以便在我不在线时可以处理它。我使用的是 4.9.2 版标准。检查 chrome 控制台给出了几个 404 错误,这些错误在使用 FireFox 时并不明显。恢复到 CDN 解决了​​这个问题。不幸的是,没有离线工作,至少对于这个版本的ckeditor来说似乎不是。