1. 程式人生 > >富文字編輯器kindeditor 前臺獲取編輯內容 ,及後臺獲取內容

富文字編輯器kindeditor 前臺獲取編輯內容 ,及後臺獲取內容

必須的js方法

KindEditor.ready(function(K) {
	editor = K.create('textarea[name="contents"]',options);
	
});

KindEditor.sync();


判斷編輯的內容是否為空

function validate(){

	var title =$.trim( $("#title").val());
	var content = $.trim($("#contents").val());
	
	editor.sync(); 
	content=  $("#contents").val();
	if(content == ""){
		alert("內容不能為空")

		return false;
	}
		return true;
}