Change CSS within iframe on same domain
I am using JSColor script on the admin panel of my web application and I also have an iframe on the same page to preview the changes made to colors. I want the iframe's style update when I change colors using the color picker of JSColor. As this example shows, the following code changes the body background color of the current page.
How can I modify it so that it will change the background color of the iframe (iframe id is "preview")?
onchange="document.getElementsByTagName('body').style.background = '#'+this.color"