Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CKEDITOR, AutoFocus on the text editor onLoad

Anyone know how to autofocus on the CKEDITOR text area on page load?

Currently the user has to click in the text area before they can start typing. Like Google, I'd like the page to load and the user can immediately start typing w/o having to click the text area.

Here is the current code that initiated CKEDITOR

<script type="text/javascript">
CKEDITOR.replace( 'meeting_notes',
    {
        toolbar :
        [
            [ 'Bold', 'Italic', 'Underline', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
            ['Cut','Copy','Paste','PasteText'],
            ['Undo','Redo','-','RemoveFormat'],
            ['TextColor','BGColor'],
            ['Maximize']
        ]
    });
</script>

Thanks

like image 662
AnApprentice Avatar asked Dec 22 '09 04:12

AnApprentice


3 Answers

Perhaps the startupFocus config option?

CKEDITOR.replace( 'meeting_notes',
    {
        startupFocus : true,
        toolbar :
...
like image 161
ZoogieZork Avatar answered Sep 22 '22 02:09

ZoogieZork


I've not tried it myself, but check out the CKEDITOR.config.startupFocus.

Definition: Sets whether the editor should have the focus when the page loads.

like image 34
o.k.w Avatar answered Sep 22 '22 02:09

o.k.w


In your config simply do this:

    config.startupFocus = true;
like image 32
Carlos Pliego Avatar answered Sep 24 '22 02:09

Carlos Pliego