Question

I am trying to Edit a certain div within iFrame using NicEdit, but it's not working.

This is my code:

<html>
<head>
    <title></title>
    <script type="text/javascript" src="nicEdit.js"></script>
</head>
<body>

    <div id="Panel"></div>
    <iframe src="x.html" onload="loadMe(this)"></iframe>


    <script type="text/javascript">
        var myNicEditor

        function loadMe(who){
            var x = who.contentWindow.document.getElementById("text")
            myNicEditor = new nicEditor()
            myNicEditor.setPanel('Panel')
            myNicEditor.addInstance(x)
        }

    </script>
</body>
</html>

NicEdit sets the div's contentEditable to true successfully, but the buttons are not working (fontSize, fontFamily, bold....). Any ideas?

Was it helpful?

Solution

Solved:

in nicEdit.js line 578

replace the line with:

iFrameID.contentWindow.document.execCommand(cmd,false,args);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top