Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

afoysal's avatar

Uncaught ReferenceError of CKEditor

I am trying to count Words and Characters of CKEditor. My Code is like below.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/A1.1-MC-style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
    <link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
    <link rel="stylesheet" href="/resources/demos/style.css">
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
      integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <link href="https://netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.css" rel='stylesheet' type='text/css'>
    <title>Blog Posts</title>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js"
      integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
      crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
      integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF"
      crossorigin="anonymous"></script>
    <script src="https://code.jquery.com/jquery-3.6.0.js"></script>
    <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
    <!-- Bootstrap JavaScript -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.2/js/bootstrap.min.js"
      crossorigin="anonymous"></script>
  </head>
  <body>
    <div class="container-fluid p-0">
      <div id="main-doc" class="">
        <div class="container-fluid main">
          <div class="sections">
            <script src="https://nightly.ckeditor.com/full/ckeditor.js"></script>
            <div class="section-1">
              <div class="row ms-lg-4">
                <div id="editor"></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <script>
      document.addEventListener('DOMContentLoaded', function () {
        ClassicEditor
          .create(document.querySelector('#editor'), {
            extraPlugins: 'wordcount',
            wordcount: {
              showParagraphs: false,
              showWordCount: true,
              showCharCount: true,
              countSpacesAsChars: true
            }
          })
          .catch(error => {
            console.error(error);
          });
      });
    </script>
  </body>
</html>

But I am getting error Uncaught ReferenceError: ClassicEditor is not defined.

0 likes
1 reply
AungHtetPaing__'s avatar

@afoysal how did you install? Can you try it with cdn? If it works, you didn't link or load ckeditor script properly.

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

Please or to participate in this conversation.