CKEditor .focus() in instanceReady event is not working

Kyaw Thurein picture Kyaw Thurein · Apr 12, 2011 · Viewed 27.3k times · Source

I am having problems in setting the focus in instanceReady event of CKEditor 3.4.1. I have already tried the following two ways but both of them are not always working.

CKEDITOR.on('instanceReady', function(e) { CKEDITOR.instances.editor1.focus(); });


CKEDITOR.replace('editor1',
{
    on :
    {
        instanceReady : function( ev )
        {
            ev.editor.focus();
        }
    }
} );

Answer

GianFS picture GianFS · Feb 16, 2013

or maybe try this, this is much simpler:

use startupFocus : true

so your code should look like this:

CKEDITOR.replace('editor1',
{
    startupFocus : true,
...