zoukankan      html  css  js  c++  java
  • KindEditor 给KindEditor赋值

    在项目的过程中,使用了KindEditor编辑器,然后在赋值的时候,我的编辑器ID是content,然后我想通过$("#content").html()来赋值,发现赋值失败,后来百度的值,方法如下:
            var editor1 = null;//首先声明一个全局变量
            KindEditor.ready(function (K) {
                editor1 = K.create('#content', {
                    cssPath: '../js/plugins/code/prettify.css',
                    uploadJson: 'upload_json.ashx',
                    fileManagerJson: 'file_manager_json.ashx',
                    allowFileManager: true,
                    afterCreate: function () {
                        var self = this;
                        K.ctrl(document, 13, function () {
                            self.sync();
                            K('form[name=example]')[0].submit();
                        });
                        K.ctrl(self.edit.doc, 13, function () {
                            self.sync();
                            K('form[name=example]')[0].submit();
                        });
                    },
                    afterBlur: function () { this.sync(); }//这一步非常重要,如果遗漏,则后台无法接收到数据。
                });
                prettyPrint();
            });  

    然后再在需要赋值的时候,就这样写,如下:
     editor1.html("测试赋值"); 



    本次经验分享到此结束,转载请保留原作者地址以及姓名(本人无偿分享经验,有偿接单制作Android或者IOS平台的APP,有需要可以联系我。);

    作者:南宫萧尘  
    E-mail:314791147@qq.com
    QQ:314791147
    日期:2016-04-29

  • 相关阅读:
    concurrent-锁
    字符串查找字符串
    指针作为函数返回值
    数组名作为函数参数
    指针和函数
    多级指针
    指针数组
    指针运算
    指针和数组
    const修饰的指针类型
  • 原文地址:https://www.cnblogs.com/nangong/p/4bde8a063940c7758bf5a693efe0e2ca.html
Copyright © 2011-2022 走看看