How to replace words in an iframe in designMode?

170 views Asked by At

I want to replace some words like "php", because when I put PHP code in HTML tags the codes are hiding.

Entered PHP code gets hidden when inside an HTML tag

$('#editor').contents().find('<?php').replaceWith('');

or something like this:

$('#editor').contents().find('body').html().replace('<?php', '');

this is my code :

var myEditor = function(Tag){
        if (document.selection){
            var range = myIFrame.selection.createRange();
            range.pasteHTML("<" + Tag + ">" + range + "</" + Tag + ">");

        }else if(document.getSelection){
            var range = myIFrame.getSelection().getRangeAt(0);
            var nnode = myIFrame.createElement(Tag);
                range.surroundContents(nnode);
                nnode.innerHTML = range;
        }
    }
0

There are 0 answers