I need to set focus on a codepress iframe via javascript, but I haven't get success.
I've tried (texto is the codepress iframe object):
texto.focus();
texto.firstChild.focus();
texto.editor.getEditor().focus();
texto.parentNode.focus();
texto.previousSibling.blur(); // with the TAB key I get focus, so...
texto.editor.insertCode('\u2009', false); // trying to force caret to appear...
Does someone have some idea?
I'm in FF3.
Regards,
Sony
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
I need to set focus on a codepress iframe via javascript, but I haven't get success.
I've tried (texto is the codepress iframe object):
texto.focus();
texto.firstChild.focus();
texto.editor.getEditor().focus();
texto.parentNode.focus();
texto.previousSibling.blur(); // with the TAB key I get focus, so...
texto.editor.insertCode('\u2009', false); // trying to force caret to appear...
Does someone have some idea?
I'm in FF3.
Regards,
Sony
I did it!
texto.contentWindow.focus();
It was missing some iframe issues to my skills.
Next challenge: try to set caret position at end of text when getting focus.
Forgot to mention: in my code it worked better after some time, eg:
setTimeout('texto.contentWindow.focus()', 100);
but it's enough for me! :)
Sony