CKeditor editor is an upgraded version of FCKeditor.
For FCK, it is really easy to use and the loading speed is faster.
The following example shows how to obtain the value of the CKeditor editor through JS for form verification.
If (CKEDITOR. instances. content. getData () = ""){
Alert ("content cannot be blank! ");
Return false;
}
Content is the name of textarea
Next time I send CKeditor configuration and upload configuration, I only get PHP Upload
A friend said that the field cannot be determined to be blank in FIREFOX. I modified it a little.
I passed the test under FF. The following is the JS Code.
Function trim (str ){
Return str. replace (/(^/s *) | (/s * $)/g ,"");
} // Remove Spaces
Var str = CKEDITOR. instances. content. getData ();
Str = str. replace ("<br/> ","");
Str = str. replace ("<br> ","");
Str = trim (str );
If (str = ""){
Alert ("content cannot be blank! ");
Return false;
}
In use, combine them. Thank you for your suggestion.
/*
**************************************** ***********************************/
The eval () function computes a string and executes the JavaScript code. (A very important function)
Var cke_arr = CKEDITOR. instances;
Eval ("var cke_content = CKEDITOR. instances." + ta_id + ". getData ();");