Mac
Mac

Reputation: 7533

fckeditor not working in firefox

var oEditor = FCKeditorAPI.GetInstance("<%=FCKeditorSelfDocument.ClientID %>");
        var oDOM = oEditor.EditorDocument;
oDOM.body.innerText = 'Hello';

it is working fine in IE and chrome but not working in firefox 3.6.4

Upvotes: 0

Views: 1248

Answers (2)

rick schott
rick schott

Reputation: 21117

FireFox does not use innerText:

'innerText' works in IE, but not in Firefox

Upvotes: 1

Mac
Mac

Reputation: 7533

IE uses document.all that's why it supports the format but there is a work around for firefox

var oEditor = FCKeditorAPI.GetInstance("<%=FCKeditorSelfDocument.ClientID %>");
            var oDOM = oEditor.EditorDocument;
            if (document.all)
            {

                oDOM.body.innerHTML = 'hello';// for IE
            }
            else //For firefox
            {
                var geckoRange = oDOM.createRange();
                geckoRange.selectNodeContents(oDOM.body);
                geckoRange = 'hello';
                oDOM.body.innerHTML = geckoRange;
            }

now it work for both

Upvotes: 0

Related Questions