A-A+
使用Ajax提交表单时如何将kindeditor编辑器中的内容赋值给textarea
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>
Warning: A non-numeric value encountered in /data/wwwroot/lxy.me/wp-content/themes/Ality/inc/functions/comment-template.php on line 16
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /data/wwwroot/lxy.me/wp-content/themes/Ality/functions.php on line 249
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /data/wwwroot/lxy.me/wp-content/themes/Ality/functions.php on line 249
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /data/wwwroot/lxy.me/wp-content/themes/Ality/functions.php on line 249