1初始化kindeditor
var clearDefault=true;//是否有默认文字信息
var editor = KindEditor.create('textarea[name="s_content"]', {
allowFileManager : true,
filterMode:true,
width : '100%',
height:'291px',
items:items_simp,
afterFocus : function(){//获得焦点 删除默认文字信息
editor.sync('#s_content');
if(clearDefault){
if(document.getElementById('s_content').value=="<span style=\"color:#999999;\">企业简介(不少于</span><span style=\"color:#999999;\">600</span><span style=\"color:#999999;\">字)、图片(不少于一张、 图片宽不得大于</span><span style=\"color:#999999;\">800px</span><span style=\"color:#999999;\">,高不限)、宣传视频可根据企业情况选择上传。</span>"){
KindEditor.html("#s_content","");
}
clearDefault=false;
}
},
afterBlur: function(){this.sync();}//失去焦点,同步信息数据
uploadJson : '<%=basePath%>/r/plugins/kindeditor/jsp/upload_json.jsp',
fileManagerJson : '<%=basePath%>/r/plugins/kindeditor/jsp/file_manager_json.jsp'
});
2点击清除默认信息
点击清除默认信息
//同步kindeditor至<textarea>内
editor.sync('#s_content');
//清空kindeditor内容
KindEditor.html("#s_content","");
//初始为true 首次点击清除kindeditor内容后 变为false
clearDefault=false
//获取文本内容使用原生js
document.getElementById('s_content').value