最近用了一個開源編輯器kindeditor,國產的還是十分不錯的,在判斷編輯器輸入值的時候,找了一會兒,現在將代碼拿出來
主要是kindeditor判斷輸入是否為空,獲取kindeditor的html內容 獲取kindeditor的text文本內容。
其實kindeditor延續了jquery的獲取方式,主要是用kindeditor創建的對象來操作,而不是jquery對象
創建editor對象
var editor = KindEditor.create('textarea[name="content1"]...
創建的對象就可以拿到對應的html和text值了,這樣就可以判斷kindeditor輸入是否為空
editor.html();是獲取編輯器內容的html代碼
editor.text();是獲取編輯器內容,是去除了html的。
判斷kindeditor是否為空就簡單了if(editor.html()=="")則就能判斷了~
更多信息請查看IT技術專欄