Tinymce 4.2.0得到无法读取null的属性'setContent' [英] Tinymce 4.2.0 got Cannot read property 'setContent' of null
本文介绍了Tinymce 4.2.0得到无法读取null的属性'setContent'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我想使用setContent函数时,我得不到null的属性'setContent'。用于Tinymce库生成的文本编辑器中的设置值。实现它是错误的吗?以下是我的代码:
I got Cannot read property 'setContent' of null, when i want to using setContent function. Intended for set value in text editor generated by Tinymce library. Is am wrong to implemented it?Below is my snippet code:
<textarea name="content"></textarea>
<script src="assets/tinymce/tinymce.min.js"></script>
<script>
tinymce.init({
selector:'textarea'
});
tinymce.activeEditor.setContent('custom');
</script>
有谁知道这个问题?
谢谢!任何努力都将受到赞赏
Does anyone knows about this problem? Thanks! any effort would be appreciated
推荐答案
你必须等到编辑器初始化:
You have to wait until the editor is initialized:
tinymce.init({
selector:'textarea',
init_instance_callback : function(editor) {
editor.setContent('custom');
}
});
这篇关于Tinymce 4.2.0得到无法读取null的属性'setContent'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文