如何在CKEditor中使用Javascript设置值? [英] How do I set a value in CKEditor with Javascript?
本文介绍了如何在CKEditor中使用Javascript设置值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何在 CKEditor
中使用Javascript设置值?
I am wondering how I can set a value in CKEditor
using Javascript?
,但是它们都不工作...
I have tried the following, but neither of them work...
document.[form name].[textarea name].value=data;
$('#textareaID').val(data);
但是,这两个工作都没有应用编辑器。
However, both these work without the editor applied. Is there a way I can do this with the editor?
推荐答案
Use the CKEditor method setData()
:
CKEDITOR.instances[**fieldname**].setData(**your data**)
这篇关于如何在CKEditor中使用Javascript设置值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文