thomas-hiron thomas-hiron - 3 years ago 192
Javascript Question

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() ;

But the line below returns me this error:

Uncaught TypeError: object is not a function

var oFCKeditor1 = new CKEDITOR('message');

Any idea ?

Answer Source

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

    <script type="text/javascript" src="/ckeditor/ckeditor.js"></script>

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' );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download