admin管理员组文章数量:1399839
CKEditor 4 not working, getting this error: ([CKEDITOR] Error code: editor-incorrect-element. {element: "body"} ckeditor.js:21 ).
My textarea has an id="body". I have added the script in the header. Everything is as it should be, but still not sure why it doesn't work. Any help is appreciated.
CKEDITOR.replace('body');
CKEditor 4 not working, getting this error: ([CKEDITOR] Error code: editor-incorrect-element. {element: "body"} ckeditor.js:21 ).
My textarea has an id="body". I have added the script in the header. Everything is as it should be, but still not sure why it doesn't work. Any help is appreciated.
CKEDITOR.replace('body');
Share Improve this question asked Jun 17, 2020 at 10:34 BobiBobi 331 gold badge1 silver badge4 bronze badges2 Answers
Reset to default 3<head>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
</head>
The editor operates on textarea
elements, so create one in your body somewhere:
<textarea id="editor1" name="editor1"></textarea>
Then initialize the editor with the following code after the declaration of your textarea element:-
<script type="text/javascript">
CKEDITOR.replace( 'editor1' );
</script>
Check if you are calling same id or same class in other element before ckeditor textarea is called.
Eg.
<textarea class="editor_1" id="editor_1"></textarea>
Check if same id or class is not called in any div above textarea
Eg.
<div class="editor_1" id="editor_1"></div>
本文标签: javascriptCKEditor 4 not working due to error editorincorrectelementStack Overflow
版权声明:本文标题:javascript - CKEditor 4 not working due to error editor-incorrect-element - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744139259a2592543.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论