用JS动态创建CKEditor的方法

前端开发CKEditor 776

在使用javascript动态创建textarea文本框并加载CKEditor的时候需要先destory之前的CKEditor,然后重新加载,具体调用下面函数就好了:

var loadCkeditor = function(){
	for(name in CKEDITOR.instances)
	{
	    CKEDITOR.instances[name].destroy()
	}	

	if($(".page-content").length > 0){
		 $('.page-content').each( function () {
		    CKEDITOR.replace( this.id , {
		  		height: '500px',
		    });
		});
	}
};

Post Comment