在很多帮助下,我终于让CKEditor更新了相关的文本区域.
See the post here.
但是,当表单上有超过1个CKEditor时,我很难理解如何让CKEditor更新每个相关的文本区域.
这是我目前拥有的jquery.它仅更新表单上的最后一个CKEditor关联文本区域:
for (var i in CKEDITOR.instances) {
CKEDITOR.instances[i].on('change',function() { CKEDITOR.instances[i].updateElement() }); //update the relative hidden textarea.
}
当表单上有5个或10个CKEditor时,如何更新每个关联的CKEditor文本区域?
解决方法
对于要在页面上安装的每个ckeditor实例,请将以下代码添加到jquery脚本中:
CKEDITOR.instances['id_of_text_area'].on('change',function() { CKEDITOR.instances['id_of_text_area'].updateElement() });
上面的JavaScript应该替换我在原始问题中显示的代码.
我希望这对一些人有所帮助.