KindEditor提交用jquery获取不到数据的解决方法

<script>

var editor;
KindEditor.ready(function(K) {
  editor = K.create('#editor_id');
如果是用ajax方式提交的话,这样是获取不到数据的,最关键的是数据不同步
在html页面中的javascript程序要这样写
<script type="text/javascript">
   KindEditor.ready(function(K){
                K.create('textarea[name="content"]', {
                themeType: 'simple',
                resizeType: 1,
                uploadJson: 'common/KEditor/upload_json.php',
                fileManagerJson: 'common/KEditor/file_manager_json.php',
                allowFileManager: true,
        //经测试,下面这行代码可有可无,不影响获取textarea的值
       // afterCreate: function(){this.sync();}
        //下面这行代码就是关键的所在,当失去焦点时执行 this.sync();
        afterBlur: function(){this.sync();}
});
});
</script>

简单模式

     var editorMini = KindEditor.create('.editor', {
             '100%',
            height: '250px',
            filterMode: false, //默认不过滤HTML
            resizeType: 1,
            afterBlur: function () { this.sync() },
            uploadJson: '{config.webpath}tools/upload_ajax.ashx?action=EditorFile&IsWater=1',
            items: [
                'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                'insertunorderedlist', '|', 'emoticons', 'image', 'link']
                
        });
原文地址:https://www.cnblogs.com/qigege/p/4965964.html