#9163 closed Bug (invalid)
IE8 & IE 7: not getting CKEditor.instances in IE8 and below version of IE
Reported by: | Amit.Mukherjee | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | 3.6.2 |
Keywords: | Cc: | deepak.bakshani@… |
Description (last modified by )
I am trying to attach the change , focus and blur events to my CKEditor instances that are dynamically generated.Find below the code. Its working fine for Ie9 and other browsers but not getting the instances in IE8 and below IE versions. Here is the code.
<script type="text/javascript"> if (window.addEventListener) { window.addEventListener('load', onpageload, false); } else { window.attachEvent('onload', onpageload); } </script>
and the function is :
function onpageload(e) { var dirtyField = document.getElementById("dirtyfield"); for (var i in CKEDITOR.instances) { CKEDITOR.instances[i].on('change', function () { dirtyField.value = true; }); CKEDITOR.instances[i].on('focus', function () { this.document.$.childNodes[1].childNodes[1].style.backgroundColor = '#ebf5d0'; }); CKEDITOR.instances[i].on('blur', function () { this.document.$.childNodes[1].childNodes[1].style.backgroundColor = '#FFFFFF'; }); } }
Unable to get the instances in IE8 so the code in not able to loop and attach the events with the instances.
Attachments (1)
Change History (9)
comment:1 Changed 12 years ago by
Keywords: | IE 8 CKEditor.instances added |
---|
comment:2 Changed 12 years ago by
Description: | modified (diff) |
---|---|
Keywords: | IE 8 CKEditor.instances removed |
Changed 12 years ago by
Attachment: | replacebycode2.html added |
---|
comment:3 follow-up: 5 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:4 Changed 12 years ago by
Try to look for any JavaScript errors. IE9 supports addEventListener
so if this is not cache problem then for some reason you have problem with attachEvent
which is used in IE6-8.
comment:5 Changed 12 years ago by
Replying to j.swiderski:Hello,
I have tried your code on my side, its not working I mean if you focus on any editor its background color in not changing to green. Also you are replacing the textarea by its ID but we can't use Id. We are replacing them by class name. Find below the code for the same. Its not working with class name.
CKEDITOR.config.height = "90px"; CKEDITOR.config.autoParagraph = false; CKEDITOR.config.fillEmptyBlocks = false; CKEDITOR.config.resize_enabled = false; CKEDITOR.config.removePlugins = 'elementspath';
CKEDITOR.config.toolbar = 'Cms'; CKEDITOR.config.toolbar_Cms =
[
['Bold', 'Underline', 'Italic', '-', 'Subscript', 'Superscript'],
];
CKEDITOR.replaceClass = 'supersub_scripts';
Please note that the CKEditor development website is not the right place for support requests.
Please refer to the following article for information on where to get support for all issues related to CKEditor: http://docs.cksource.com/CKEditor_3.x/Howto/Support
Also try using our forums for advice: http://cksource.com/forums/
If you are looking for professional assistance, the CKEditor development team is available via a dedicated support channel that is included in all our commercial licenses: http://ckeditor.com/license
Please note that I have tried your code and didn't have problem with running it in any browser. I have tested it in CKEditor 3.6.4.Perhaps you haven't refreshed cache properly.
comment:6 Changed 12 years ago by
If u are testing the code then the background of editor should change to green on Focus also if u put an alert in the change event it should give you an alert when you type something. Please check these behaviours in IE8 & IE7
comment:7 follow-up: 8 Changed 12 years ago by
Drop native eventListeners and use CKEditor api. We have created it for a reason you know.
CKEDITOR.on('instanceReady', function onpageload() { var dirtyField = document.getElementById("dirtyfield"); for (var i in CKEDITOR.instances) { CKEDITOR.instances[i].on('change', function () { dirtyField.value = true; }); CKEDITOR.instances[i].on('focus', function () { this.document.$.childNodes[1].childNodes[1].style.backgroundColor = '#ebf5d0'; }); CKEDITOR.instances[i].on('blur', function () { this.document.$.childNodes[1].childNodes[1].style.backgroundColor = '#FFFFFF'; }); } });
comment:8 Changed 12 years ago by
Replying to j.swiderski:Hello
As per your suggestion i have tried the same but still i am not getting the instances in IE8,IE7
Drop native eventListeners and use CKEditor api. We have created it for a reason you know.
CKEDITOR.on('instanceReady', function onpageload() { var dirtyField = document.getElementById("dirtyfield"); for (var i in CKEDITOR.instances) { CKEDITOR.instances[i].on('change', function () { dirtyField.value = true; }); CKEDITOR.instances[i].on('focus', function () { this.document.$.childNodes[1].childNodes[1].style.backgroundColor = '#ebf5d0'; }); CKEDITOR.instances[i].on('blur', function () { this.document.$.childNodes[1].childNodes[1].style.backgroundColor = '#FFFFFF'; }); } });
Please note that the CKEditor development website is not the right place for support requests.
Please refer to the following article for information on where to get support for all issues related to CKEditor: http://docs.cksource.com/CKEditor_3.x/Howto/Support
Also try using our forums for advice: http://cksource.com/forums/
If you are looking for professional assistance, the CKEditor development team is available via a dedicated support channel that is included in all our commercial licenses: http://ckeditor.com/license
Please note that I have tried your code and didn't have problem with running it in any browser. I have tested it in CKEditor 3.6.4.Perhaps you haven't refreshed cache properly.