thomas-hiron
thomas-hiron

Reputation: 948

How to install CKeditor

I don't know how to install CKeditor, I downloaded the editor on the website and then put the following code between my head tags :

<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript">
    window.onload = function()
    {
        var oFCKeditor1 = new CKEDITOR('message');
        oFCKeditor1.ToolbarSet = 'Basic' ;
        oFCKeditor1.BasePath = "ckeditor/" ;
        oFCKeditor1.ReplaceTextarea() ;
    }
</script>

But the line below returns me this error:

Uncaught TypeError: object is not a function

var oFCKeditor1 = new CKEDITOR('message');

Any idea ?

Upvotes: 2

Views: 13933

Answers (2)

dodiya vijay
dodiya vijay

Reputation: 69

I was written one article for it on this link. maybe it helps Include the js file in your web page. you can also use CKEditor CDN

<script src="https://cdn.ckeditor.com/4.9.2/standard/ckeditor.js"></script>

OR

<script src="CKEditor_file_path/ckeditor.js"/>

 After select textarea where you want to add CKEditor

 <textarea name="editor1" id="editor1" rows="10" cols="80">
           This Textarea Replaced By CKEditor.
  </textarea>

Write code to replace textarea in CKEditor

<script>
      CKEDITOR.replace( 'editor1' );
</script>

"editor1" is the name of textarea for more information you can view this blog

http://besticoder.com/how-to-use-ckeditor-in-your-website-for-user-input/

Upvotes: 0

Ryan
Ryan

Reputation: 6527

According to the documentation, include the ckeditor.js file:

<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">&lt;p&gt;Initial value.&lt;/p&gt;</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: 12

Related Questions