It is possible to loop through all the CKEditor instances like:
for(var instanceName in CKEDITOR.instances) {
...
}
Some of the CKEditors are hidden in my case. So, how is it possible to loop through the visible CKEditors?
It is possible to loop through all the CKEditor instances like:
for(var instanceName in CKEDITOR.instances) {
...
}
Some of the CKEditors are hidden in my case. So, how is it possible to loop through the visible CKEditors?
Share Improve this question asked Aug 8, 2016 at 11:41 websterwebster 4,0326 gold badges41 silver badges61 bronze badges4 Answers
Reset to default 5I ended up checking the visibility of the closest div
for(var instanceName in CKEDITOR.instances) {
if($("#"+instanceName).closest(".form-group").is(':visible')){
...
}
}
try with setTimeout(function(){},1000); as sometime one javascript instance is ongoing and by loop it is going to create another one so may b chances for nonworking. try your logic with setTimeout .it will work.
for(var instanceName in CKEDITOR.instances) {
setTimeout(function(){
if($("#"+instanceName).closest(".form-group").is(':visible')){
...## your code goes here
}
}, 3000);
}
Try like this way...
Try this:
for (var instance in CKEDITOR.instances) {
if (CKEDITOR.instances.hasOwnProperty(instance)) {
if (CKEDITOR.instances[instance].closest(".wrapper").is(':visible')) {
...
}
}
}