1、common use
include script label:
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
create textarea element with id="editor":
<textarea id="editor" name="editor" rows="5" cols="55"></textarea>
append script follow textarea:
<script type="text/javascript">
var instance = CKEDITOR.instances['shortAnswerEditor'];
if (instance) {//消除已经创建的实例
CKEDITOR.remove( instance);
} else{
CKEDITOR.replace( 'shortAnswerEditor' );//创建新实例
}
</script>
2、java ckeditor
add jar into web-inf/lib path:
ckeditor-java-core-3.5.3.jar
add taglib into jsp page:
<%@ taglib uri="http://ckeditor.com" prefix="ckeditor" %>
add ckeditor tag (for more see api):
<ckeditor:replaceAll basePath="ckeditor/" className="shortAnswer"/>