Wednesday, February 9, 2011

How can I set the focus inside the Yahoo Rich Text Editor

I have a an HTML form which contains the YAHOO rich text editor on it.

When I display the form I want the YAHOO editor to have focus so that the cursor is ready to accept input without the user having to click on it or tab into it

  • I haven't employed the YAHOO rich text editor, but wouldn't it work, if you use a window.onload event ?-)

    From roenving
  • Like roenving, I have never used the YAHOO rich text editor, but it should work with the window.onload event.

    Let's say you specified id="yahoo_text_editor" for your YAHOO rich text editor.
    Then, do

    <body onload="document.getElementById('yahoo_text_editor').focus()">
    

    Hope this helps.

    From pmg
  • I got this from the documenation over at the YUI library. Specifically at a sample titled Editor - Basic Buttons

    var myEditor = new YAHOO.widget.Editor('editor', {focusAtStart:true});
    myEditor.render();

    The key here is the the "focusAtStart" attribute as part of the optional attributes object

    From Benry

0 comments:

Post a Comment