不工作这是我的代码到目前为止已经实现的CKEditor在IE11
<div class="CommentBox" style="display: none;">
<div class="editor-field">
@Html.TextAreaFor(model => model.ObjComment.Description, new { @id = "txtComment", @class = "clsCKEditor" })
</div>
</div>
而jQuery代码如下:
$("#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");
});
这里,txtComment是文字区域的id,这将我正在使用编辑器。点击按钮后,将生成编辑器,并显示包含此编辑器的div。
这和Chrome和Firefox中的预期一致。但是,它在IE11中给出的错误在这一行:
var editor = CKEDITOR.instances[txtComment];**'txtComment' is undefined**
Ami错过了什么?你能帮我解决这个问题吗?提前致谢。
更改txtComment为“txtComment”工作。非常感谢。 – user2645738