dimanche 6 décembre 2015

CKEditor not working in IE11

This is the code i've implemented so far

<div class="CommentBox" style="display: none;">
   <div class="editor-field">
     @Html.TextAreaFor(model => model.ObjComment.Description, new { @id = "txtComment", @class = "clsCKEditor" })
   </div>
</div>

And the JQuery code is as follows:

 $("#btnComment").click(function () {        
        var editor = CKEDITOR.instances[txtComment];
        if (CKEDITOR) {
            if (CKEDITOR.instances.txtComment) {
                CKEDITOR.instances.txtComment.destroy();
            }
        }
        $("#txtComment").val('');
        CKEDITOR.replace('txtComment', { uiColor: '#D8D8D8' });

        CKEDITOR.config.htmlEncodeOutput = true;
        $(".CommentBox").show("slow");           
    });

Here, txtComment is an id of the textarea which i'm using as an Editor. On click of the button, the editor will be generated and the div containing this editor will show up.

This is working perfectly as expected in Chrome and Firefox. However,its giving error in IE11 at this line:

var editor = CKEDITOR.instances[txtComment];**'txtComment' is undefined**

Ami missing something? Would you please help me resolve this. Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire