Fckeditor doesn’t want to focus in Firefox? Solution
FCKEditor is a nice free WYSIWYG editor, highly customizable. Occasionally, however, especially when used with a div that shows/hides or JavaScript doesn’t want to focus properly in Firefox. Here’s a way I found around about it.
function wakeUpFireFoxFckeditor()
{
var oEditor = FCKeditorAPI.GetInstance(‘myinstanceoffckeditor’) ;
try
{
oEditor.MakeEditable();
}
catch (e) {}
oEditor.Focus();
}
Just to add:
- It’s best to call FCKeditorAPI – in fact you’d get an error if you did – after the page is loaded. Hence it’s in a function. You could probably tie it to a body onload, or onclick=”", etc.
- Use the try/catch approach. IE complains that you are waking up Firefox, so this is just a way to gracefully make both of them happy.
- Focus for usability. More commands available at: http://wiki.fckeditor.net/Developer%27s_Guide/Javascript_API
