I'm using CKEditor to change my textareas into a wysiwyg. It all works fine, except when i load content through an Ajax call. Then my CKEditor doesn't load.
I've searched for a solution, but couldn't find any that worked for me.
My Ajax call basically looks like this:
$.ajax({
type: "POST",
url: url,
success: function(data) {
$('#content').html(data);
$('.ckeditor').ckeditor();
}
});
As you can see i tried to use the function ckeditor() to programmatically load the CKEditor. But this gives me the following error:
FireFox says:
$(".ckeditor").ckeditor is not a function
And IE says:
Object doesn't support property or method 'ckeditor'
Is there any other way to load the CKEditor by class name when the content is loaded through an Ajax call??
First you have to load the jquery adapter '/path/to/ckeditor/adapters/jquery.js'
Than $('.ckeditor').ckeditor();
will work.
you can use command:
CKEDITOR.replace( 'editor1' );
but with one difference - editor1 is the id of the textarea and not the class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With