views:

260

answers:

3

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

A: 

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

roenving
A: 

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.

pmg
+1  A: 

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

Benry