今天在整合SpringMVC+mybatis后台项目时用了KindEditor富文本框编辑器,最后提交时无法获取值,最后百度了很久终于解决了这个问题,直接在创建编辑器的时候需要使用sync()去同步HTML数据,最终代码如下:
var editor;
KindEditor.ready(function(K) {
editor = K.create('textarea[name="content"]', {
resizeType : 1,
allowPreviewEmoticons : false,
allowImageUpload : false,
afterBlur: function () { this.sync(); },
items : [
'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
'insertunorderedlist', '|', 'emoticons', 'image', 'link']
});
});
多了一行同步数据项:
afterBlur: function () { this.sync(); },
如果您觉得本文的内容对您的学习有所帮助:
关键字:
KindEditor Ajax表单提交