Failpunk Failpunk - 5 months ago 38x
Javascript Question

How do you set the focus of a TinyMCE textarea element?

I'm using TinyMCE for a textarea on a page but it doesn't play nice in the tabbing order of the other elements.

I can use the following code to capture when I tab out of the first element:

$('#title').live('keypress', function (e) {
if(e.keyCode == 9) {
alert('tabbed out');

How can I set the focus to a TinyMCE editor?


Finally found an answer... use the command:


For my purposes, 'id_of_texterea' was "description", ie

<textarea id="description" ... ></textarea>

In the form element that preceded my textarea, I added the execCommand above to the element's "onblur" action.