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']
                    
            });
  • 相关阅读:
    前端框架-Bootstrap【搭建后台管理系统】
    前端-jQuery
    前端-js基础语法-DOM
    前端-js基础语法
    前端-html标签
    python学习并发编程
    python学习网络编程
    python爬虫学习:第一爬_快眼看书排行榜
    python总结:模块汇总
    python学习_解释器接口模块:sys
  • 原文地址:https://www.cnblogs.com/qigege/p/4965964.html
Copyright © 2011-2022 走看看