Reputation: 33
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');
Upvotes: 3
Views: 14759
Reputation: 422
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>
Upvotes: 0
Reputation: 1995
<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>
Upvotes: 3