[英]Get CKEDITOR id and value using event
CKEDITOR 4 编辑器4
$(document).ready(function(){
CKEDITOR.on('instanceCreated', function(e) {
e.editor.on('contentDom', function() {
e.editor.document.on('keyup', function(event) {
//want current ckeditor id
});
});
});
});
I have more than one ckeditor and all are creating at run time. 我有一个以上的ckeditor,并且都在运行时创建。 Is it possible to get ck editor's id and value if I have event object.
如果我有事件对象,是否可以获取ck编辑器的ID和值。
You didn't mention which version so I'm assuming 4.x. 您没有提到哪个版本,所以我假设使用4.x。 You could loop through the instances to find the document:
您可以遍历实例来查找文档:
e.editor.document.on('keyup', function(event) {
for (name in CKEDITOR.instances) {
var instance = CKEDITOR.instances[name];
if (instance.document == this) {
alert('ID: ' + instance.id + '\nName: ' + instance.name + '\n' + instance.getData());
break;
}
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.