ckeditor内容转换为textarea上的变化事件 - 多个ckeditors在窗体上 [英] ckeditor content into textarea on change event - multiple ckeditors on form

查看:690
本文介绍了ckeditor内容转换为textarea上的变化事件 - 多个ckeditors在窗体上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有了很多帮助,我终于得到了CKEditor来更新相关的文本区域。 查看此处的帖子

With a lot of help I finally got the CKEditor to update the associated text area. See the post here.

然而,当表单上有多于一个CKEditor时,我很难理解CKEditor如何更新每个相关的文本区域。

However, I am stumped of how to get the CKEditor to update each associated text area when there is more than 1 CKEditor on the form.

这里是我现在的jquery。它只更新表单上最后一个CKEditor关联的文本区域:

Here is the jquery that I currently have. It only updates the last CKEditor associated text area on the form:

    for (var i in CKEDITOR.instances) {
        CKEDITOR.instances[i].on('change', function() { CKEDITOR.instances[i].updateElement() }); //update the relative hidden textarea.
    }

我如何更新每个关联的CKEditor文本区域或10个CKEditor在表单上?

推荐答案

对于您要在页面上安装的ckeditor的每个实例,请在您的jquery脚本中添加以下代码:

For each instance of the ckeditor that you want to install on your page, add the following code to your jquery script:


CKEDITOR.instances['id_of_text_area'].on('change', function() { CKEDITOR.instances['id_of_text_area'].updateElement() });


jquery代码应该替换原来问题中显示的代码。

The above jquery code should replace the code I have displayed in the original question.

我希望这将有助于一些。

I hope this will help some one.

这篇关于ckeditor内容转换为textarea上的变化事件 - 多个ckeditors在窗体上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆