Hello everyone,
Just downloaded CKEditor & CKFinder to see if it's suitable for our companies CMS. Really impressed so far but just running into a few problems.
How do you access the CKEditor instance? I've searched the forum and a few people have referenced this code but it doesn't seem to work for me:
I've only got one textarea on the page, but this is set dynamically so there could be more. I've tried accessing the instance using the following but none seem to work:
Any ideas?
Thanks for your help
Just downloaded CKEditor & CKFinder to see if it's suitable for our companies CMS. Really impressed so far but just running into a few problems.
How do you access the CKEditor instance? I've searched the forum and a few people have referenced this code but it doesn't seem to work for me:
for(var instanceName in CKEDITOR.instances) {
console.log( CKEDITOR.instances[instanceName] );
}
I've only got one textarea on the page, but this is set dynamically so there could be more. I've tried accessing the instance using the following but none seem to work:
CKEDITOR.instances.editor1 CKEDITOR.instances[editor1] CKEDITOR.instances["editor1"]
Any ideas?
Thanks for your help

Re: Getting CKEDITOR instance
<textarea name="html_link_content" id="content">TEXT</textarea> <script type="text/javascript"> var editor = CKEDITOR.replace('html_link_content'); /* =====INSTANCE====== */ var instance = CKEDITOR.instances.content; instance.updateElement(); $("#output").attr("value",instance.getData()); </script>Re: Getting CKEDITOR instance
Re: Getting CKEDITOR instance
What kind of better solution?
Re: Getting CKEDITOR instance
i have found a solution by adding a class on my textarea and make my plugin's code more generic.
EDIT :
Nice, i have found a solution:
Re: Getting CKEDITOR instance
CKEDITOR.instances is an object as declared in core/ckeditor.js line 22, so I run a foreach loop to determine it's methods and properties:
var myinstances = []; //this is the foreach loop for(var i in CKEDITOR.instances) { /* this returns each instance as object try it with alert(CKEDITOR.instances[i]) */ CKEDITOR.instances[i]; /* this returns the names of the textareas/id of the instances. */ CKEDITOR.instances[i].name; /* returns the initial value of the textarea */ CKEDITOR.instances[i].value; /* this updates the value of the textarea from the CK instances.. */ CKEDITOR.instances[i].updateElement(); /* this retrieve the data of each instances and store it into an associative array with the names of the textareas as keys... */ myinstances[CKEDITOR.instances[i].name] = CKEDITOR.instances[i].getData(); }Hope this helps... Pardon my bad english...