Quantcast
Channel: 恋香缘 –恋香缘
Viewing all articles
Browse latest Browse all 77

使用Ajax提交表单时如何将kindeditor编辑器中的内容赋值给textarea

$
0
0

KindEditor在火狐下或者其他浏览器下都无法得到textarea文本框的值。

首先描述下我这边遇到的KindEditor错误现象:
1、在IE8/FF下均得不到值;
2、当点击KindEditor的全屏按钮切换到全屏模式输入时,再返回正常模式,可以得到值;
3、我用的是jQuery的ajax点击事件提交表单的,无法得到值;
4、直接用表单的提交按钮可以得到值。

那么如何解决上述的这些问题呢?

<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,
            //下面这行代码就是关键的所在,当失去焦点时执行this.sync(),同步输入的值到textarea中;
            afterBlur: function(){this.sync();}
        });
    });
</script>


Viewing all articles
Browse latest Browse all 77

Latest Images

Trending Articles



Latest Images