zoukankan      html  css  js  c++  java
  • 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']
                    
            });
  • 相关阅读:
    webpack4入门配置
    RequireJs的理解
    js一次控制 多个style样式
    vue中封装一个全局的弹窗js
    地理位置索引 2d索引
    索引属性 稀疏索引,定时索引
    索引属性 unique指定
    索引属性 name指定
    mongodb索引 全文索引使用限制
    mongodb索引 全文索引之相似度查询
  • 原文地址:https://www.cnblogs.com/qigege/p/4965964.html
Copyright © 2011-2022 走看看