I’m having a problem with some css+javascript. You see, I’m trying to make some sort of a wysiwyg webpage style editor in which there is an iframe which load a webpage containing code of something like this.
<head>
<style id=mystyle>
/* something is here */
</style>
</head>
<body>
<h1>Other, quite a lot autogenerated stuff along with javascript that add some interactivity.</h1>
</body>
Now, I need to modify the content of #mystyle so that it reflect to the page in realtime. Using jquery, I tried to do so using several technique, like:
$(#mystyle).html(newcss);$(#mystyle).replaceWith("<style id='mystyle'>"+newcss+"</style>")$(#mystyle).after("the newcss along with style tag"), then delete the old one.$(#mystyle).delete()//just to see what happen.
All of the above fail to change the look of the webpage. In fact, deleting the tag (4.), did not turn the page ugly and I did check using “Inspect Element”, the html does change but the appearance do not. So…. what did I do wrong?
using
htmlseems to work just fine. see:http://jsfiddle.net/tGSkS/