Search code examples
javascriptphplocalhostckeditorhosting

CKEditor not working when the site is depoyed (PHP)


CKEditor not working when the site is deployed(000webhost). It works fine in localhost. I included CDN in the header

<script src="https://cdn.ckeditor.com/ckeditor5/28.0.0/classic/ckeditor.js"></script>

and I used it in a form

 <div class="form-group">
         <label for="post_content">Post Content</label>
         <textarea class="form-control" name="post_content" id="editor" cols="30" rows="10"></textarea>
     </div>



 <script>
        ClassicEditor
            .create( document.querySelector( '#editor' ) )
            .catch( error => {
                console.error( error );
            } );

    </script>

Solution

  • Code is looking proper. Also it is working deployed server. But there might issue of loading cdn library. Please check it is loaded correctly.

    <div class="form-group">
             <label for="post_content">Post Content</label>
             <textarea class="form-control" name="post_content" id="editor" cols="30" rows="10"></textarea>
         </div>
    <script src="https://cdn.ckeditor.com/ckeditor5/28.0.0/classic/ckeditor.js"></script>
    <script>
    
      ClassicEditor
        .create( document.querySelector( '#editor' ) )
        .catch( error => {
            console.error( error );
        } );
    
    </script>