一、获取富文本kindeditor的内容:ajax
咱们在js文件中建立富文本框kindeditor,须要首先在表单中设置一个隐藏的textarea用于存放富文本框中的内容。即:异步
<textarea id="content" name="content" style="width:100%;height:600px;border: 0 none;visibility:hidden;"></textarea>
另外,要实现ajax异步上传可以成功获取富文本框中的内容,必须要在建立富文本时添加代码:afterBlur:function(){this.sync();},目的是使得失去焦点时自动将富文本框中的数据同步到文本域textarea中。this
var editor; KindEditor.ready(function(K) { editor = K.create('textarea[name="content"]', { afterBlur:function(){this.sync();}, resizeType : 1, allowPreviewEmoticons : false, }); });
设置好以后便可简单获取textarea中的内容,即:var content=$("#content").val()spa
二、判断富文本框中内容是否为空code
editor.isEmpty()同步