Run code before and after CkEditor Initilize
/*
* Will only work if called before 'replace'
* because after 'replace' the instance of the editor
* would have already been created and this won't run
*/
CKEDITOR.on("instanceCreated", function(event) {
alert('Editor instance created');
});
CKEDITOR.replace( 'editor');
CKEDITOR.on("instanceReady", function(event) {
alert('Editor instance ready');
});
<textarea name="editor"></textarea>