Check if CKEditor is empty

Taewook Kang

The following code will get you the current text value. Make sure to replace "editor1" with the ID of your editor.

CKEDITOR.instances.editor1.document.getBody().getChild(0).getText() ;

Here is an example how this code can be used:

function check_form() {
	var editor_val = CKEDITOR.instances.editor1.document.getBody().getChild(0).getText() ;
	if (editor_val == '') {
		alert('Editor value cannot be empty!') ;
		return false ;
	return true ;

<form onsubmit="return check_form()">

(Works with CKEditor 3.5.+)