0
votes

I am trying to make simple web editor using CKEditor but i cant find out how to make it work.

First i checked their samples site. Only thing they do to make CKEditor work is include .js file and add ckeditor class to form textarea element.

<script src="../ckeditor.js"></script>
.
.
.
<textarea class="ckeditor" cols="80" id="editor1" name="editor1" rows="10">

So i copy .js file and try it in my own folder and when i run php script whole textarea element is hidden and doesnt create CKEditor panel as it should like in this sample page. There might be some javascript configuration but i havent found any in source code of sample page.

3
Open your browser debugger. See any errors? - Diodeus - James MacFarlane

3 Answers

10
votes

call CKEDITOR.replace( 'editor1' ); in your js files or simply in your html file like this:

<textarea class="ckeditor" cols="80" id="editor1" name="editor1" rows="10">
<script>
  CKEDITOR.replace( 'editor1' );
</script>
6
votes
  1. Copy all of your ckeditor folder to server.
  2. Add it to html page ;like this:

    <script src="../script/ckeditor/ckeditor.js" type="text/javascript"></script>
    
  3. Assign CSS class of ckeditor to textarea; like class="ckeditor".

1
votes
<script src="../ckeditor.js"></script>
      <form name="ckeditor">
         <textarea name="editor1" id="editor1" rows="10" cols="80">
            This is my textarea to be replaced with CKEditor.
        </textarea>
        <script>
            // Replace the <textarea id="editor1"> with a CKEditor
            // instance, using default configuration.
            CKEDITOR.replace( 'editor1' );
        </script>
</form>

As given in the main website.