Skip to content Skip to sidebar Skip to footer

Cant Create Style Tag In Iframe Head

Here's jsfiddle --> http://jsfiddle.net/uTy5j/7/embedded/result/ I'm using CodeMirror and it seems that Codemirror is erasing my style tag that I create with: var preview = docu

Solution 1:

You just have to wait until the iframe is loaded before you try to insert stuff:

preview.onload = function() {
    var style = document.createElement('style');
        style.id = 'mycssid';
        style.type ='text/css';
        mypreview.head.appendChild(style);
}

FIDDLE

Post a Comment for "Cant Create Style Tag In Iframe Head"